I'm running Windows 98 (just to get that out of the way).
Hello again,
I snagged a copy of C++ for Dummies from the library and was typing the first example program into Dev-C++. After numerous errors, I finally got the code right, but when I ran it, instead of displaying the text it was supposed to, it just showed "Press any key to continue..." I was sure I got the code right, so I figured it was the compiler's fault and just moved on.
About half-way through the first section of Chapter 2, I got inspiration to make a simple 'average of three numbers' program. The result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
//
// Program to find the
// average of three numbers
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
cout << "This program will find the average of three numbers.";
// enter the numbers you want
// to find the average of
double valueOne; double valueTwo; double valueThree;
cout << "Enter the first number:";
cin >> valueOne;
cout << "Enter the second number:";
cin >> valueTwo;
cout << "Enter the third number:";
cin >> valueThree;
// calculate the average
// of the numbers
double average;
average = (valueOne + valueTwo + valueThree) / 3;
cout << "The average is:";
cout << average << endl;
return 0;
}
|
(Let me add here that the displayed text came out as one line; if the solution is easy, could you let me know what it is?)
It looked pretty good to me and the IDE said there were no errors, so I tried to run it. It displayed "Press any key to continue..." and patiently waited for my input. By then it was starting to annoy me and I figured that I couldn't learn a programming language if I couldn't run any of my programs. So I went to a friends house (who's father programs as a hobby) and entered the same code in Visual C++ 6.0, and the program ran just fine ('cept the no breaks in the line, but that of course is because I'm an idiot).
So that is my problem. Is there a soulution? Maybe an alternate IDE (I could steal VCPP6 (<<is that a valid acronym?) from the friend?)?
I'll also add that the programs ran fine in debug mode (which I pressed by mistake).
Any help is appreciated.