Hello im a newbie and I dont understand c++ that much but im still learning.
I can't seem to find what my error is for this basic program...Mind helping me and showing me the way?
#include <iostream>
using namespace std;
int a;
int b;
int main ()
{
cout << "hello sajjad!";
cout <<"put in your age...";
cin>> a;
}
//Person was born on feb. 29(leap year)
if (a==0<)
{
cout<< "Sajjad is";
b=a/4;
cout<<b
cout<<"YEARS OLD!!!";
cout<<"HAHAHA!!!";
return 0;
}
First thing first, next time use the code tag (the <> symbol on the right under Format) to make the code easier to see. The if and else statement is not in any function, I think you main to put them in the main function i.e like this
1 2 3 4 5 6 7 8 9 10 11
int main()
{
if ()
{
//code here
}
else ()
{
//code here
}
}
Your main function should also return something, usually return 0; and I do not think your comparisons are valid.
IDE stand for Integrated Development Environment; it is used to help coding and compiling programs easier. For the error, if you post the code again, this time use the <> tag, it would help us see what you did wrong.