I keep getting this error whenever I compile my program. I am using XCode and am not sure of what to do or how to fix this error.
This is not the entire program so don't worry if you don't see a return 0 or anything.Code:#define TIMER_H_DEF #include <iostream> #include <string> #include <sys/time.h> int main () class Timer // <----- Error: Expected initializer before 'class' { public: timer(); ~Timer(); using std::cout; using std::cin; using std::string; int enter, gold, number, america, newgold; int twogold, city, threegold, passcode; // Beginning of game. cout << "Welcome to the coin game. " << "The objective is to get 1000 coins by the end.\n" << "\nNow please create a random 8 number passcode " << "using ONLY numbers.\n"; cin >> enter; while (enter <= 10000000 || enter >= 99999999 ) { cout << "\nYour passcode is less than 8 digits " << "(do not use 0 as the first digit).\n"; cout << "Please try again.\n"; cin >> enter; } cout << "\nFirst, solve 432 * 23, " << "in order to get your first 50 coins " << "(no calculators!).\n"; timer.start(); cin >> number; timer.stop(); cout << "You took " << timer.getElapsedTimeInMilliSec << " ms " << "to solve the equation.";




Reply With Quote