Trying something basic and need help
Posted: Tue Jan 20, 2009 5:57 pm
Ok well im watching AntiRTFM episodes and im currently on episode 19. Well i take detailed notes in some regular college bound notebooks i have when i watch videos, read books, look at tutorials.
So basically before i write this code down as a example code for declaring voids i want to make sure it works. So i quickly drew out this code:
The code basically shows how to declare the voids, if im doing it wrong tell me, and has a little number game tutorial. So i go to compile and i get this error:
Ive read over my code, and the error about 4 times now and i do not get where my 'constant' is.
So basically before i write this code down as a example code for declaring voids i want to make sure it works. So i quickly drew out this code:
Code: Select all
/* This is the system boot section where it loads headers for the program. */
#include "stdafx.h"
#include <iostream>
using namespace std;
/* Declaration section of the program */
void function1()
{
cout << "Function 1 loaded.\n";
}
void function2()
{
cout << "Function 2 loaded.\n";
}
void function3()
{
cout << "Function 3 loaded.\n";
}
/* Main function section */
int main()
{
int thenumber 76;
int playerguess;
cout << "Lets play guess my number, type a number between 0-100.\n";
cin >> playerguess;
if (playerguess == thenumber)
cout << "You won!\n";
else
cout << "Try again...\n";
function1();
function2();
function3();
char f;
cin >> f;
return 0;
}
Code: Select all
1>------ Build started: Project: Example of a declared code, Configuration: Debug Win32 ------
1>Compiling...
1>stdafx.cpp
1>Compiling...
1>AssemblyInfo.cpp
1>Example of a declared code.cpp
[color=#FF0000]1>.\Example of a declared code.cpp(28) : error C2143: syntax error : missing ';' before 'constant'[/color]
1>Generating Code...
1>Build log was saved at "file://c:\Users\Kyle\Documents\Visual Studio 2008\Projects\Example of a declared code\Example of a declared code\Debug\BuildLog.htm"
1>Example of a declared code - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========