Re: [Dev-C++] How do i correct a syntax error
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Charles N. <hi...@ne...> - 2002-03-30 04:21:49
|
You need a main() function and semicolons after your cout's. And you =
can't have spaces in your variable names. It compiles fine now, but I'm =
not sure it does what you want it to.
#include <iostream>
#include <iomanip>
using std::cout;
using std::cin;
using std::endl;
float number;
int main()
{
float number1, number2, number3, number4, number5;
cout << " Enter 5 floating point numbers " << endl;
cin >> number1 ;
cin >> number2 ;
cin >> number3 ;
cin >> number4 ;
cin >> number5 ;
cout << " The floating point numbers are " << endl;
cout << " number 1 is " << setprecision(2)
<< setiosflags(ios::fixed | ios::showpoint);
cout << " number 2 is " << setprecision(2)
<< setiosflags(ios::fixed | ios::showpoint);
cout << " number 3 is " << setprecision(2)
<< setiosflags(ios::fixed | ios::showpoint);
cout << " number 4 is " << setprecision(2)
<< setiosflags(ios::fixed | ios::showpoint);
cout << " number 5 is " << setprecision(2)
<< setiosflags(ios::fixed | ios::showpoint);
return 0;
}
|