I've just installed c++ express 2010 and am playing around with a "hello world" type code that I picked up off the internet. This is the code.
#include <iostream>
using namespace std;
#include "conio.h"
void main(){
cout << "Hello World";
_getch();
}
Now, I've debugged the program and it works fine, but when I change what the message will be, such as "Hello everyone", when I debug it the previous message, "Hello World", shows up in the window.
Does anyone know what the problem is here and why I can't get the new message to show up? Any help would be much appreciated.
When I click debug doesn't it recompile by itself? Or is there an option somewhere to recompile?
**edit
I've tried going under Debug and choosing Build Solution and it didn't work the first couple of times and I just tried it once more and it worked. So I tried the same thing again and it's not working again. So confusing.
Are you using MS VS? If so, that has a dialogue box that says "the code is out of date" when you try to run and haven't built changes to the source code. You may have accidentally said No and told it to not ask again.
It seems the only solution for getting it to change is deleting the executable every time I change something in the code. I've even tried changing the code to things that wouldn't allow the program to execute, it would give an error, and the program still runs.
If you are new to programing then here is a litile program for you
1 2 3 4 5 6 7 8
#include <windows.h>
int main()
{
system("color 74"); //changes the color to white bakground and red text
Beep(500, 2000);// 500 maga herts sound for 2 seconds
Beep(900, 2000);// 900 maga herts sound for 2 seconds
cout<< "hi my name is nupy!" <<endl;// displays a text
system("pause");
Zhuge (1521) Mar 21, 2011 at 10:40pm
Are you using MS VS? If so, that has a dialogue box that says "the code is out of date" when you try to run and haven't built changes to the source code. You may have accidentally said No and told it to not ask again.
If this was the case (as I fear I have done), how to you change it back to Yes?
Well, thanks for all the suggestions guys, but I tried it out on a regular PC, not my Mac, and it worked fine. I blame my Mac. Basically I have to delete the .exe every time I run my program and want to change something in it. It's annoying but it's the only laptop I have so I'll have to make do.