Hello, Im using dev C++(i dont know if it matters or not) and every once in a while ill get this bug in the code with my input and output(cin/cout) i have the line of (using namespace std;) and im including the iostream and usuall a few others. can anyone tell me if there is something else that could go wrong with that i mean i have everything else typed in correctly and nothing else is wrong. for example i just got this problem from this line. cout << x << endl;
if anyone has a soution or explination please let me know thanks.
#include <iostream>
usingnamespace std;
int main()
{
int x; // Maybe you did not Create the varible.
cout<<"Enter a number\n";
cin>>x; //Store what you entered into x (Only numbers, no lettters, no words)
cin.ignore(); //Dont count this time you press Enter. (Dont close program)
cout<<"You entered: "<<x; // show what you entered as the number
cin.get(); //Wait until u press Enter, and then close
}
Hope that helps you. I think you may have forgot making the variable (int x;)