Saturday, February 12, 2011

void bringer()

I was inspired from reading Brandon Sanderson's The Way of Kings to write a little C++ program. If you have a C++ compiler handy (doesn't everyone??) feel free to run the code. No it is not spectacular but I wanted to do something fun! By the way - my code does have spoilers!

#include <iostream>

using namespace std;

void bringer(void);

void main (void ){

//The Way of Kings by Brandon Sanderson - loved it!
//Reading about the void bringers I just had to create a function void bringer().

cout << "What are the void bringers? "<<endl;
bringer();
cout << "\n\nThank you for playing!"<<endl;

}

void bringer(){
char option = 'x'; //x is my default
//keep looping until the user chooses a valid option
do {
cout<< "\n(K)aladin"
<< "\n(S)hallan"
<< "\n(D)alinar"
<< "\n(P)arshendi\n"
<< "Choose one:";
cin >> option;

switch (option) {
case 'K': case 'k':
cout<< "\nI will protect those who cannot protect themselves. Not a voidbringer. Try again";
//I loved this part in the book. Chapter 67. Oh my. It might be my
//favorite chapter in any book.
break;

case 'S': case 's':
cout<<"\nI'm a murderer. I killed my father. Not a voidbringer. Try again";
//We thought she might have killed him and took his shardblade
break;

case 'D': case 'd':
cout<< "\nWhat is a man's life worth? Not a voidbringer. Try again";
//Wow this chapter made me love Dalinar!
break;

case 'P': case 'p':
cout<< "\nRight on!";
//I didn't see this one coming
break;

default: cout << "\nPlease try again :)\n";

}
} while ((option != 'p')&&(option !='P'));

}

2 comments:

Joel said...

select *
from Earth
where name = 'Gina Cooper'
and Cool = True

0 rows returned

select *
from Earth
where name = 'Gina Cooper'
and SuperBigNerd = True

1 row returned

Gina Cooper said...

select headsize from Earth where name = 'Joel Cooper';

Error: Maximum integer size exceeded