Hey, i was thinking these may help me if I made these little programs etc, but i've came to a situation, I've go no error but have to use
cin.get();
twice, here's the whole program..
#include <iostream>
using namespace std;
int main()
{
system("title Simple use of if else if loops.");
system("Color C");
int digit;
cout << "Enter a positive digit: ";
cin >> digit;
if( digit > 0 )
{
cout << endl << "Thank you!";
}
else if( digit < 0 )
{
cout << endl << "I said postive!";
}
cin.get();
cin.get();
return 0;
}
The reason i have to use it twice is that if I only use it once the program just opens and closes straight away, I am not sure but I am certain it is because i have made the program for the user to console input the variable digit, am I correct with my theory?