Why doesn't "new line" work?
\n or <endl doesn't work......here's 2 test programs in which it doesn't work, but for others, it does....why?
Code:
#include <iostream.h>
int main()
{
int slot1
int slot2
int slot3
int slot4
int slot5
int endr
int sure
cout<<"Please enter the top 5 things you would like to have if you were on an island alone"<<endl;
cout<<"Type the first and most important thing"<<endl;
cin>>slot1;
cout<<"Type the second thing"<<endl;
cin>>slot2;
cout<<"Type the third thing"<<endl;
cin>>slot3;
cout<<"Type the fourth thing"<<endl;
cin>>slot4;
cout<<"Type the fifth thing and the one that you would least like to have"<<endl;
cin>>slot5;
cout<<"You liked the following in order"<<endl;
cout<<"1. "slot1 <<endl;
cout<<"2. "slot2 <<endl;
cout<<"3. "slot3 <<endl;
cout<<"4. "slot4 <<endl;
cout<<"5. "slot5 <<endl;
cout<<"Am I right?";
cin>>endr;
if(endr==yes)
{
cout<<"I knew it!";
}
else if(endr==y)
{
cout<<"I knew it!";
}
else if(endr==ya)
{
cout<<"I knew it!";
}
else if(endr==yup)
{
cout<<"I knew it!";
}
else
{
cout<<"Are you sure?";
cin>>sure;
}
if(sure==yes)
{
cout<<"Sure....whatever you say...";
}
else
{
cout<<"I knew it!";
}
return 0;
}
and shorter terms......
Code:
#include <iostream.h>
int main()
{
cout<<"line 1" <<endl;
cout<<"line 2" <<endl;
return 0;
}