I am just starting to actually program a bit more rather than just read about c++ and have come up with a very basic number guessing game. I am having problems with writing effective functions and would be interested to know if a more experienced programmer would structure this problem differently.
Also is there always a way to make a program object oriented no matter how simple it is. So for example if i were to make this OO would I declare a class GuessGame and just put the funcions and variables inside the class.
Should I focus on procedural Programming first for a while or just get my hands dirty with classes from the moment i understand them .
Any constructive feedback would be great . Thanks
#include<stdlib.h> // for random numbers
using namespace std;
void CompareNumbers(int NumToGuess,int Guess);
// Makes sure the user enters a valid guess between 1-5
cout << "Enter a number" << endl;
cin.getline(input,9); //this will allow for a 9 digit number,which is bigger than an int anyways, so this should be fine
number = atoi(input); //Converts a digit string into a number
// This function produces the random number that the user has to guess
// This function compares the number produced by the computer and the number you guessed
void CompareNumbers(int NumToGuess,int Guess)
cout << "Ye Ha" << endl;
cout << "You guessed " << NumToGuess << endl;
cout << "Which is correct!" << endl;
cout << "Unlucky Sunshine" << endl;
cout << "The number you were looking for was " << NumToGuess << endl;