1.11M Members

Problem with Visual Studio 2010 Ultimate

 
0
 

I've been using Visual Studio 2010 Ultimate to learn C++ and have created a project file. Within that project file are 2 .cpp files. I use one to refresh my memory of what I've learned and the other to enhance my knowledge of C++. The problem is that whenever I try to run my code, it returns nothing but "Press any key to continue..." in the command prompt. I have created the project as Win32 Console Application and haven't messed around with any of the settings; I think. Also, I press F5 to compile and run my code as I do not know where the "Compile and Run" option is in the interface. I am trying to run this code:

#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
	double a, b;
	int c = 0;

	for (a = 1.0; a == 100; a++) {
        b = a/17;
	cout << "If the Earth is " << a << " pounds, the Moon is " << b << "pounds./n";
	}

	c++;

	if (c == 25) {
		cout << "/n";
		c = 0;
	}

	system ("PAUSE");
	return 0;
}

When I press F5, it returns nothing but "Press any key to continue...". I thought that maybe I had typed the code wrong so I wrote a very simple "Hello World" code, that also returned "Press any key to continue..." in the command prompt.

Please help!
Thanks.

 
0
 
a == 100;

This condition is not satisfied in the first iteration. So, the loop is terminated.

outside, c = 1

(c == 25)

So, even this condition is not met.

Question Answered as of 3 Years Ago by myk45
You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: