What's wrong w/this prog.?It doesn't run.

#include <iostream>
using namespace std;

int main()
{
cout << "15.0 plus2.0 equals " << (15.0 + 2.0) << endl
<< "15.0 minus 2.0 equals " << (15.0 - 2.0) << endl
<< "15.0 times 2.0 equals " << (15.0 * 2.0) << end1
<< "15.0 divided by 2.0 equals " (15.0 / 2.0) << endl ;

return 0;
}
It should run.. just the IDE you are using (or if none) doesn't pause the program at the end to let you see the final output. You can find a long, long, thread about this here -
http://www.cplusplus.com/forum/beginner/1988/
Hi,Regine
I think a "<<" is missed in line 9.
That means << "15.0 divided by 2.0 equals " (15.0 / 2.0) << endl ;
should be << "15.0 divided by 2.0 equals "<< (15.0 / 2.0) << endl ;
closed account (z05DSL3A)
It may be a typo in your post
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
using namespace std;

int main()
{
cout << "15.0 plus2.0 equals " << (15.0 + 2.0) << endl
<< "15.0 minus 2.0 equals " << (15.0 - 2.0) << endl
<< "15.0 times 2.0 equals " << (15.0 * 2.0) << end1
<< "15.0 divided by 2.0 equals " (15.0 / 2.0) << endl ;

return 0;
}







<--- should be endl not end1

Topic archived. No new replies allowed.