Re: [Dev-C++] Having trouble with Dev-C++ compiler
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Alfred P. R. <al...@ya...> - 2005-02-28 01:03:36
|
I'm trying your code snippet as a console application...
Suggestions:
I get a warning from <iostream.h>
D:/Dev-Cpp/include/c++/3.3.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
Use <iostream> instead.
However, the main issue is that at return 0; the command shell (console) automatically closes the window! Try putting:
system("PAUSE"); before the return.
using namespace std;
#include<iostream>
int main()
{
float height, diameter, volume, gallons;
cout << " Enter the diameter and the height of the cylinder " << endl;
cin >> diameter >> height;
volume = 3.1416 * (diameter/2) * (diameter/2) * height;
gallons = volume * 7.5;
cout << " The Volume of the given diameter and height is " << endl;
cout << diameter << " " << height << " " << volume << endl;
system("PAUSE");
return 0;
}
Works fine! Remember the seperators in the output and the endline, BTW, or you'll get one big line of stuff.
Ken Meisner <bic...@ea...> wrote:
<snip>
#include<iostream.h>
int main()
{
float height, diameter, volume, gallons;
cout << " Enter the diameter and the height of the cylinder " << endl;
cin >> diameter >> height;
volume = 3.1416 * (diameter/2) * (diameter/2) * height;
gallons = volume * 7.5;
cout << " The Volume of the given diameter and height is " << endl;
cout << diameter << height << volume;
return 0;
}
Alfred P. Reaud
|