#include <iostream>
#include <string>
usingnamespace std;
int main()
{
int num1;
int num2;
int num3;
string name;
cout<< "enter number"<<endl;
cin>>num1;
cout<< "enter number that is smaller than the first number you enter"<<endl;
cin>>num2;
cout<< "enter name"<< endl;
cin>>name;
if(num1>0 && num2<num1)
{
num3=num1-num2;
cout<<"A hungry group of "<<num1<<" are entering a hotdog eating contest. to win one million dollars. "<<endl;
cout<<" the group was led by it's fattest member "<<name<<endl;
cout<<endl;
cout<< "After eating thirty hotdogs "<<num2<<" of your group members vomited and were disquilified."<<endl;
cout<<"leaving only "<<num3<<" to continue on with the contest"<<endl;
cout<<endl;
cout<<"within thirty minutes your group manages to win the hotdog eating contest and win one million dollars"<<end;
}
else
cout<<"you enter an invalid input"<<endl;
return 0;
}
You should always post errors directly from the compiler - it gives line numbers and other info handy to us, and is not subject to your interpretation :+) Just mentioning this because we have had these problems in the past :+)
I compiled it with cpp.sh the gear icon top right of the code. Line 32 has end not endl
It's not recommended to use std::endl anyway: it flushes the buffer every time and could be inefficient. Just use"\n" instead:
std::cout << " the group was led by it's fattest member " << name << "\n";
or
std::cout << "you enter an invalid input\n";
usingnamespace std; is not recommended either, that's why I have std:: before each std thing. Google to see why :+)