aaronkupen
Fully Optimized
- Messages
- 1,848
- Location
- Pittsburgh, PA
<code>
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
cout << "Welcome to MyMath calculator.";
cout << "Enter the first digit you would like to calculate with.";
int nFirst;
cin >> nFirst;
cout << "Enter the second digit you would like to calculate with.";
int nSecond;
cin >> nSecond;
int nSum, nDifference, nProduct;
double dQuotient;
nSum = nFirst + nSecond;
nDifference = nFirst - nSecond;
nProduct = nFirst * nSecond;
cout << nSum;
cout << nDifference;
cout << nProduct;
if (nSecond != 0)
{
double dFirst, dSecond;
dFirst = nFirst;
dSecond = nSecond;
dQuotient = dFirst/dSecond;
cout << dQuotient;
}
else
{
cout << "You can not divide by zero";
}
system("PAUSE");
return 0;
}
</code>
That is the code I am putting into dev C++ at my school during java class. When i compile i get a message that says line 2, file H:\c++\2 (my program is H:\C++\MyMath), and it just says unable to run program file. There might be something wrong with my code or the schools security isnt allowing me to use this compiler, because i installed it on my own during my free time. Any help would be appreciated.
P.S. I don't know how to show code on this properly, if you haven't noticed already.
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
cout << "Welcome to MyMath calculator.";
cout << "Enter the first digit you would like to calculate with.";
int nFirst;
cin >> nFirst;
cout << "Enter the second digit you would like to calculate with.";
int nSecond;
cin >> nSecond;
int nSum, nDifference, nProduct;
double dQuotient;
nSum = nFirst + nSecond;
nDifference = nFirst - nSecond;
nProduct = nFirst * nSecond;
cout << nSum;
cout << nDifference;
cout << nProduct;
if (nSecond != 0)
{
double dFirst, dSecond;
dFirst = nFirst;
dSecond = nSecond;
dQuotient = dFirst/dSecond;
cout << dQuotient;
}
else
{
cout << "You can not divide by zero";
}
system("PAUSE");
return 0;
}
</code>
That is the code I am putting into dev C++ at my school during java class. When i compile i get a message that says line 2, file H:\c++\2 (my program is H:\C++\MyMath), and it just says unable to run program file. There might be something wrong with my code or the schools security isnt allowing me to use this compiler, because i installed it on my own during my free time. Any help would be appreciated.
P.S. I don't know how to show code on this properly, if you haven't noticed already.