//Declerations
//Question Strings
string a; //Asking if you want to play
string b; //Asking if you want to draw red or blue
string c; //Asking if you want to go back to the menu
string d; //Asking if you want to play again
//Variable Declerations
int r; //Variable With A Random Value
int t; //Variable With Your Total Score
int d; //Pick a deck
int red; //Prepping Red Matrix
int blue; //Prepping Blue Matrix
//Microprogram Declerations
int MAIN();
int PLAY();
void RULES();
void DETERMINE();
void SETVALUES();
void LOSS();
//Active Play
int PLAY(){
system("cls");
srand ( time(NULL) );
r = rand() % 1 + 0;
cout<<"Your total is "<< t <<"!"<<endl;
cout<<"Pick a deck"<<endl;
cout<<"Red or Blue"<<endl;
cin>> d;
if (d == "Red" || d == "red"){
t = t + red[r];
DETERMINE();
}
if (d == "Blue" || d == "blue"){
t = t + blue[r];
DETERMINE();
}
else
PLAY();
}
//If the player has lost, do this
void loss(){
system("cls");
cout<<"You Have Lost"<<endl;
system("pause");
return;
}
//Algorithim to determine weather or not the player has been stupid enough to lose a game of luck yet.
void DETERMINE(){
if (t > 0)
PLAY();
if (t == 0 || t < 0)
LOSS();
else{
system("cls");
cout<<"FATAL SYSTEM ERROR"<<endl;
system("pause");
return;
}
//Setting the initials Values
void SETVALUES(){
t = 500;
int red[0] = {-50};
int red[1] = {50};
int blue[0] = {-100};
int blue[1] = {100};
}
//Telling the player the rules
void RULES(){
cout<<"The Rules of the game are simple"<<endl;
cout<<"You start out with 500 dollars"<<endl;
cout<<"Draw from either the Red or the Blue deck"<<endl;
cout<<"Each deck has card that either add or subtract from your pool"<<endl;
cout<<"Have Fun!";
cout<<"press anykey to go back to the menu"<<endl;
system("pause");
MAIN();
return;
//Starting Welcome Menu
int MAIN(){
system("cls");
cout<<"Welcome to the Red Blue Card Game"<<endl;
cout<<"Featured in Malcom Gladwell's Blink"<<endl;
cout<<""<<endl;
cout<<"Type Rules to View The Rules"<<endl;
cout<<"Or, Type Play to Play The Game"endl;
if (a == "Rules" || a == "rules")
RULES();
if (a == "Play" || a == "play")
SETVALUES();
}
1>------ Build started: Project: Red Blue Card Game, Configuration: Debug Win32 ------
1>Build started 8/21/2011 7:16:10 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Red Blue Card Game.unsuccessfulbuild".
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>ClCompile:
1> MAIN.cpp
1>MAIN.cpp(17): error C2371: 'd' : redefinition; different basic types
1> MAIN.cpp(13) : see declaration of 'd'
1>MAIN.cpp(34): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>MAIN.cpp(39): error C2088: '>>' : illegal for class
1>MAIN.cpp(40): error C2088: '==' : illegal for class
1>MAIN.cpp(40): error C2088: '==' : illegal for class
1>MAIN.cpp(41): error C2109: subscript requires array or pointer type
1>MAIN.cpp(44): error C2088: '==' : illegal for class
1>MAIN.cpp(44): error C2088: '==' : illegal for class
1>MAIN.cpp(45): error C2109: subscript requires array or pointer type
1>MAIN.cpp(74): error C2601: 'SETVALUES' : local function definitions are illegal
1> MAIN.cpp(61): this line contains a '{' which has not yet been matched
1>MAIN.cpp(83): error C2601: 'RULES' : local function definitions are illegal
1> MAIN.cpp(61): this line contains a '{' which has not yet been matched
1>MAIN.cpp(107): fatal error C1075: end of file found before the left brace '{' at 'MAIN.cpp(83)' was matched
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.20
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#include<iostream>
#include<string>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
usingnamespace std;
//Declerations
//Question Strings
string a; //Asking if you want to play
string b; //Asking if you want to draw red or blue
string c; //Asking if you want to go back to the menu
string d; //Asking if you want to play again
//Variable Declerations
int r; //Variable With A Random Value
int t; //Variable With Your Total Score
string x; //Pick a deck
int red; //Prepping Red Matrix
int blue; //Prepping Blue Matrix
//Microprogram Declerations
int MAIN();
void PLAY();
void RULES();
void DETERMINE();
void SETVALUES();
void LOSS();
//---------------------------------------------------------------
//Active Play
void PLAY(){
system("cls");
srand ( time(NULL) );
r = rand() % 1 + 0;
cout<<"Your total is "<< t <<"!"<<endl;
cout<<"Pick a deck"<<endl;
cout<<"Red or Blue"<<endl;
cin>> x;
if (x == "Red" || x == "red"){
t = t + red[r];
DETERMINE();
}
if (x == "Blue" || x == "blue"){
t = t + blue[r];
DETERMINE();
}
else
PLAY();
}
//If the player has lost, do this
void loss(){
system("cls");
cout<<"You Have Lost"<<endl;
system("pause");
return;
}
//Algorithim to determine weather or not the player has been stupid enough to lose a game of luck yet.
void DETERMINE(){
if (t > 0)
PLAY();
if (t == 0 || t < 0)
LOSS();
else{
system("cls");
cout<<"FATAL SYSTEM ERROR"<<endl;
system("pause");
return;
}
}
//Setting the initials Values
void SETVALUES(){
t = 500;
red[0] = {-50};
red[1] = {50};
blue[0] = {-100};
blue[1] = {100};
}
//Telling the player the rules
void RULES(){
cout<<"The Rules of the game are simple"<<endl;
cout<<"You start out with 500 dollars"<<endl;
cout<<"Draw from either the Red or the Blue deck"<<endl;
cout<<"Each deck has card that either add or subtract from your pool"<<endl;
cout<<"Have Fun!";
cout<<"press anykey to go back to the menu"<<endl;
system("pause");
return;
}
//Starting Welcome Menu
int MAIN(){
system("cls");
cout<<"Welcome to the Red Blue Card Game"<<endl;
cout<<"Featured in Malcom Gladwell's Blink"<<endl;
cout<<""<<endl;
cout<<"Type Rules to View The Rules"<<endl;
cout<<"Or, Type Play to Play The Game"endl;
if (a == "Rules" || a == "rules")
RULES();
if (a == "Play" || a == "play")
SETVALUES();
}
1>------ Build started: Project: Red Blue Card Game, Configuration: Debug Win32 ------
1>Build started 8/21/2011 8:39:30 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Red Blue Card Game.unsuccessfulbuild".
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>ClCompile:
1> MAIN.cpp
1>MAIN.cpp(34): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>MAIN.cpp(41): error C2109: subscript requires array or pointer type
1>MAIN.cpp(45): error C2109: subscript requires array or pointer type
1>MAIN.cpp(77): error C2109: subscript requires array or pointer type
1>MAIN.cpp(77): error C2059: syntax error : '{'
1>MAIN.cpp(77): error C2143: syntax error : missing ';' before '{'
1>MAIN.cpp(77): error C2143: syntax error : missing ';' before '}'
1>MAIN.cpp(78): error C2109: subscript requires array or pointer type
1>MAIN.cpp(78): error C2059: syntax error : '{'
1>MAIN.cpp(78): error C2143: syntax error : missing ';' before '{'
1>MAIN.cpp(78): error C2143: syntax error : missing ';' before '}'
1>MAIN.cpp(79): error C2109: subscript requires array or pointer type
1>MAIN.cpp(79): error C2059: syntax error : '{'
1>MAIN.cpp(79): error C2143: syntax error : missing ';' before '{'
1>MAIN.cpp(79): error C2143: syntax error : missing ';' before '}'
1>MAIN.cpp(80): error C2109: subscript requires array or pointer type
1>MAIN.cpp(80): error C2059: syntax error : '{'
1>MAIN.cpp(80): error C2143: syntax error : missing ';' before '{'
1>MAIN.cpp(80): error C2143: syntax error : missing ';' before '}'
1>MAIN.cpp(102): error C2146: syntax error : missing ';' before identifier 'endl'
1>MAIN.cpp(102): warning C4551: function call missing argument list
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.76
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========