Hi,
I am using Dev-C++ 4.9.9.2, when compiling and running the following code,
[CODE=cpp]#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nAverage, int a, int b, int c)
{
nAverage=((a+b+ c)/3);
cout << "Please enter first numerical Value: ";
cin >> a;
cout << "Please enter the second numerical Value: ";
cin >> b;
cout << "Please enter the third numerical Value: ";
cin >> c;
cout << "The average is: " << nAverage <<endl;
return 0;
}[/CODE]
I do not get the average in cout, the cmd screen closes after accepting the inputs.
Borland works fine.
What is wrong?
Thanks
I am using Dev-C++ 4.9.9.2, when compiling and running the following code,
[CODE=cpp]#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nAverage, int a, int b, int c)
{
nAverage=((a+b+ c)/3);
cout << "Please enter first numerical Value: ";
cin >> a;
cout << "Please enter the second numerical Value: ";
cin >> b;
cout << "Please enter the third numerical Value: ";
cin >> c;
cout << "The average is: " << nAverage <<endl;
return 0;
}[/CODE]
I do not get the average in cout, the cmd screen closes after accepting the inputs.
Borland works fine.
What is wrong?
Thanks
Comment