Ok so a few months ago I picked up a book on C++ programming and I’m kind of getting the basics but I don’t know how to write “my own” programs yet just reading the book trying to understand and typing them out. In the past my programs haven’t been disappearing until I pressed a button but now they do and I can’t figure it out. (even ones that worked when I wrote them disappear now) I think I remember if you don’t add return 0; to the end of a program it does this but it’s there and I just see the screen for a second. Here is the code for the new program I typed out. I ran it and I usually make a mistake or two but they’ve all been corected. (forgot to declare Aliens_killed at first:trout: )
#include <iostream>
using namespace std;
int main()
{
const int ALIEN_POINTS = 150;
int Aliens_killed = 10;
int score = Aliens_killed *ALIEN_POINTS;
cout << "score: " << score << endl;
enum difficulty {NOVICE, EASY, NORMAL, HARD, UNBEATABLE};
difficulty My_difficulty = EASY;
enum Ship_cost {FIGHTER_COST = 25, BOMBER_COST, CRUISER_COST = 50};
Ship_cost myShipCost = BOMBER_COST;
cout << "
To upgrade my ship to a Cruiser will cost "
<< (CRUISER_COST - myShipCost) << "Resource Points.
";
return 0;
}
Here is the input
'Game_stats_3.0.exe': Loaded 'C:\Users\Cody\Desktop\Learning programming\Game_stats_3.0\Debug\Game_stats_3.0.exe', Symbols loaded.
'Game_stats_3.0.exe': Loaded 'C:\Windows\SysWOW64
tdll.dll', Cannot find or open the PDB file
'Game_stats_3.0.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Game_stats_3.0.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'Game_stats_3.0.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
The program '[2032] Game_stats_3.0.exe: Native' has exited with code 0 (0x0).
And here is what I got out of it.
I searched Cannot find or open the PDB file and I got a thread on this forum telling me to run as administrator but I did and I have the same problem. I’m going to look into it more and see if my PDB file got deleted somehow. Or if you can spot a problem with my code that makes the window close without pressing a button pointing it out would be a big help. (like I said I’m still learning this stuff and I’m very prone to making mistakes. After my 4th program in the book it took me hours to find out what I did wrong and that’s when I discovered the output actually tells me where the errors are. I forgot a ; at the end of a line :crying: ) If you can help thank you.