C Example: Number Guessing Game

#include 
#include 

main() {
	printf ("Medo's Guessing Game\nGuess A Number Between 1-200\n");
	game();
	return 0;
}
game() {
	int input=0;
	int number;
	int tries=0;
	srand((unsigned)time(0));
	number=rand() % 200 + 1;
	while (input!=number){
		printf("guess a number:");
		scanf("%i",&input);
		tries = tries +1;
		if (input  number){
			printf("little bit lower\n");
		}
		if (input == number){
			printf ("Yay! you gussed it right in %d tries\n\n", tries);
			ask();
		}
	}
	return 0;
}

ask() {
	int yn;
	printf ("try again? 0/1: ");
	scanf("%d",&yn);
	if ( yn == 1 ){
		printf ("Guess the new number\n");
		game();
	}
	if ( yn !=1 ){
		printf ("Goodbye! \n\n");
		return 0;
	}
}

My 2nd C++ Program (Number Guessing Game)

#include <iostream>
#include <cstdlib>
using namespace std;
main()
{
    int Input=0;
    int number;
    number=rand() % 100 + 1;
    cout<<"Medo's Number Guessing Game\n";
    while(Input!=number)
    {
        cout<<"Guess a number: ";
        cin>>Input;
         if (Input>number) {
             cout<<"\nNumber is lower than that, Try Again\n";
         }
         if (Input<number) {
              cout<<"\nNumber is higher than that, Try Again\n";
         }
    }
    cout<<"You Gussed It Right! Good Bye!\n\n";
}

My first program in C++ (Age Calcuator)

Hello, I’ve started recently to learn C++ programming. And this is the first program I write in this awesome language:

// my first program in C++
#include <iostream>
using namespace std;

int main()
{
    time_t theTime = time(NULL);
    struct tm *aTime = localtime(&theTime);
    int currentday = aTime->tm_mday;
    int currentmonth = aTime->tm_mon + 1;
    int currentyear = aTime->tm_year + 1900;
    int day;
    int month;
    int year;
    cout << "Please enter your year of born: ";
    cin >> year;
    cout << "Please enter your month of born: ";
    cin >> month;
    cout <<"Please enter your day of born: ";
    cin >> day;
    cout << "You are: ";
    if (currentday < day) {
        currentmonth=currentmonth-1;
        currentday=currentday+30;
        cout << currentday-day << " days and ";
    }
    else {
        cout << currentday-day << " days and ";
    }
    if (currentmonth < month) {
        currentyear=currentyear-1;
        currentmonth=currentmonth+12;
        cout << currentmonth-month << " months and ";
    }
    else {
        cout << currentmonth-month << " months and ";
    }
    cout << currentyear-year << " years old\n";
}

Very simple I know, but it should be a good start for me to look forward in coding something better in C++. Maybe starting a project who knows? 😀

See ya!

Making a twitter bot in python

Python Tips

Hi there guys. I hope you are fine. In this post I am going to tell you how you can make a twitter auto favouriter or a.k.a Twitter Bot. I am not going to make a twitter follower as it will get you banned quickly if you use it a lot. This post is going to help you to increase your twitter followers organically. By organically I mean that your followers

View original post 779 more words