You need to initialize a value for x in some fashion.
This is one way to do it
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
usingnamespace std;
int main()
{
int x = 100;
if (x == 100)
cout << "x is 100";
else
cout << "x is not 100";
}
This would be another way
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
usingnamespace std;
int main()
{
int x;
cout << "Please enter a value for x: ";
cin >> x;
if (x == 100)
cout << "x is 100";
else
cout << "x is not 100";
}
#include <iostream>
usingnamespace std;
int main()
{
int x=0;
cout<<"Enter a number: ";
cin>>x;
if (x == 100)
cout << "x is "<<x;
else
cout << "x is "<<x<<" not 100";
return 0;
}