If statements.
Hi i am an absolute nebie when it comes to C++, i still cant figure out how to say, if "this" then print "this" to the screen.
whith all the turtorials i ahve read, it says:
if (true)
{
whatever
}
i dont get that, and also on some it says:
#include <iostream.h>
int main() //Most important part of the program!
{
int age; //Need a variable...
cout<<"Please input your age: "; //Asks for age
cin>>age; //The input is put in age
if(age<100) //If the age is less than 100
{
cout<<"You are pretty young!"; //Just to show it works
}
else if(age==100) //I use else just to show an example
{
cout<<"You are old"; //Just to show you it works...
}
else if(age>100)
{
cout<<"You are really old"; //Proof that it works for any condition
}
return 0;
}
how do you say this:
#include <iostream.h>
int main()
{
int i;
cout<<"state your intensions: ";
cin>>i;
if(i = "bad")
{
cout<<" you may not proceed ";
}
else if(i ="good")
{
cout<<" you may proceed";
}
else if(i = "indeclared")
{
cout<<"Why not?";
}
return 0;
}
can i please have some one debug this!!!
and i use Bloodshed Dev C++ compiler.