I got an error in my code.. can some one help me..
Code:
------ Build started: Project: Joost2, Configuration: Debug Win32 ------
Compiling...
Item1.cpp
c:\documents and settings\joost van doorn\mijn documenten\visual studio 2005\projects\joost2\joost2\item1.cpp(25) : error C2601: 'GetRand' : local function definitions are illegal
c:\documents and settings\joost van doorn\mijn documenten\visual studio 2005\projects\joost2\joost2\item1.cpp(11): this line contains a '{' which has not yet been matched
c:\documents and settings\joost van doorn\mijn documenten\visual studio 2005\projects\joost2\joost2\item1.cpp(32) : warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
Build log was saved at "file://c:\Documents and Settings\Joost van Doorn\Mijn documenten\Visual Studio 2005\Projects\Joost2\Joost2\Debug\BuildLog.htm"
Joost2 - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Code:
// job3.cpp : main project file.
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <ctime>
using namespace std;
int GetRand(int min, int max);
int main()
{
int i, r;
{
for (i = 0; i < 1; i++)
{
r = GetRand(5, 12);
}
return(0);
}
int GetRand(int min, int max)
{
static int Init = 0;
int rc;
if (Init == 0)
{
srand(time(0));
Init = 1;
}
rc = (rand() % (max - min + 1) + min);
return (rc);
}
char yourname [40] ;
cout << "(Made By Job and Joost) \n";
cout << "What is your name Sir? \n";
cout << "Sir "; cin >> yourname;
cout << "Hello Sir " << yourname << "! \n";
cout << "Welcome to the great lands of Aradona. You can navigate in the area by typing: \n";
cout << "1 : Search for a place to train. \n";
cout << "2 : Go to the armoury. \n";
cout << "3 : \n";
cout << "__________________________ \n";
cout << "Go to: " << " ";
int action;
{cin >> action;
cout << "__________________________ \n";}
if(action==1)
{
cout << "Wich way do you want to go?\n";
cout <<"1 : Karadoune \n";
cout <<"2 : Yaramana \n";
cout <<"3 : Rotjesland \n";
cout <<"____________________________\n";
cout <<"Go to: " << " ";
cin >> action;
cout << "__________________________\n";
}
if(action==1)
{
int lvl;
lvl = 05;
cout << "You are walking in the desert, suddenly a desertspider attacks you!\n Defend yourself, Engarde!";
cout <<"The level of the desert spider is 0";
printf ("Your number is %d\n", r);
cout <<"___________________________ \n";
cout <<"What will you do? |\n";
cout <<"1 : Attack (75 % cos) |\n";
cout <<"2 : Run (35 % cos) |\n";
cout <<"___________________________|\n\n";
}
if(action==2)
{
cout <<"You are walking in the green grass of the land of Aradona,\nAnd you are walking towards Yaramana,\nLuckily nobody can see you and you survive the trip.\n";
cout <<"___________________________\n";
}
if(action==3)
{
cout <<"You are walking in Rotjesland, and you find a rotje\n";
cout <<"You light it and it explodes...\n";
cout <<"You have died...";
}
else
{
cout << "Error\n";
cout << "__________________________ \n";
}
return 0;
}