I'm completely new to C++, and I found this forum.. I'm sorry if I'm not allowed to post here..
I'm following the book "beginning c++ game programming" by Michael Dawson, and I'm on page 14/ 15.
On those pages there are some codes, but they simply wont compile & run.. I get an error (red mark). I use Dev-C++.
I'm really sure that the code isn't wrong. I have even checked it up with a few sites..
Here is the code:
Code: Select all
// Game Stats
// Demonstrates declaring and initializing variables
#include <iostream>
using namespace std;
int main()
{
int score;
double distance;
char playAgain;
bool shieldsUp;
short lives, aliensKilled;
score = 0;
distance = 1200.76;
playAgain = `y';
shieldsUp = true;
lives = 3;
aliensKilled = 10;
double engineTemp = 6572.89;
cout << "\nscore: " << score << endl;
cout << "distance: " << distance << endl;
cout << "playAgain: " << playAgain << endl;
//skipping shieldsUp since you don't generally print Boolean values
cout << "lives: " << lives << endl;
cout << "aliensKilled: "<< aliensKilled << endl;
cout << "engineTemp: " << engineTemp << endl;
int fuel;
cout << "\nHow much fuel? ";
cin >> fuel;
cout << "fuel: " << fuel << endl;
typedef unsigned short int ushort;
ushort bonus = 10;
cout >> "\nbonus: " << bonus << endl;
return 0;
}
Can someone tell me whats wrong? :O
- Thanks!