Well, I finally finished the daily work for today... Got some functions added, and a new header for variables. Quite excited that I got all this completed today
[php]
//TBQ.cpp
#include "functions.h"
#include "variables.h"
using namespace std;
int main()
{
do {
system("cls");
cout << "Hi, what is your FIRST name?" << endl;
getline (cin,ITSASTRING); // getting the input from this line and inputting it into ITSASTRING
stringstream(ITSASTRING) >> firstname; // transferring data from ITSASTRING to firstname
cout << "Alright " << firstname << " what is your last?";
getline (cin,ITSASTRING); // getting the input from this line and inputting it into ITSASTRING
stringstream(ITSASTRING) >> lastname; // transferring data from ITSASTRING to lastname
cout << "alrighty then " << firstname<<" " <<lastname <<", how old are you?" << endl; // displaying firstname lastname and asking how old
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> age;// the usual cin >> age
if (age < 20) { // if age is less than 20 do the following
cout << "Hi " << firstname<< " " <<lastname << ", welcome to my application!\ntype some random word!"<< endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> randomword;
}
else
{// age was more than 20 so we do the following
cout << "Hi " << firstname<<" " <<lastname <<" sorry, but you are too old." << endl;
exit(0);
}
cout << "thats the first word that came to your mind? weird...\n"<< endl;
cout << "Enter a number"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> thisIsANumber;
cout << "was this your favourite number?"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> yesOrNo;
if(yesOrNo == "y")
{
cout << "oh, well that was an interesting favourite number.\n"<<endl;
}
else if(yesOrNo == "n")
{
cout << "oh... what is your favourite number?\n"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> favouritenumber;
}
else
{
cout << "that wasn't an answer, genius"<<endl;
}
cout << "Do you like waffles?!?!?!!? (y/n)\n"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> likeShitTacos;
if(likeShitTacos == "y")
{
cout << "I knoww they are awesome!!!! Belgian or Eggos?\n"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> BelgianOrEggos;
if(BelgianOrEggos == "b")
{
cout << "yeaaah those are the best... with strawberrys and whipped cream right?(y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> strawberry;
if(strawberry == "y")
{
cout << "mmmm waffles with strawberries and whipped cream... mmmmmmmm"<<endl;
}
else if(strawberry == "n")
{
cout << "ewwwww... You still use syrup though right? (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> syrup;
if(syrup == "y")
{
cout << "good... I was worried"<<endl;
}
else if(syrup == "n")
{
cout << "WTF MAN!!! PLAIN WAFFLES?!?!?! YOUR CRAZY"<<endl;
}
else
{
cout << "one more answer and thats it... Your booted off of this I swear."<<endl;
}
}
else
{
cout << "STOP ANSWERING THAT!!!!!!!!!!!!!"<<endl;
}
}
else if(BelgianOrEggos == "e")
{
cout << "reaally? Eggos more then Belgians? You've clearly never had a belgian waffle before..."<<endl;
}
else
{
Felse();
}
}
else if(likeShitTacos == "n")
{
cout << "Whatt?!?! you don't like waffles? gtfo...\n"<<endl;
}
else
{
cout << "This wasn't a choice, gtfo\n"<<endl;
}
cout << "do you like girls or boys? (g/b)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> girlsorboys;
if (girlsorboys == "g")
{
cout << "Oh, great, I do as well. You are a boy or a girl? (b/g)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> boyorgirl;
if (boyorgirl == "g"){
cout << "oh..."<<endl;
}
else if (boyorgirl == "b"){
cout << "oooohhh good "<<endl;
}
else{
cout << "don't push the wrong buttons please!! you're going to drive me insane!!!!"<<endl;
}
}
else if (girlsorboys == "b")
{
cout << "ewwwww are you a boy or a girl... (b/g)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> boyorgirl;
if (boyorgirl == "b"){
cout << "ok then......\n";
}
else if (boyorgirl == "g"){
cout << "ok, good "<<endl;
}
else{
cout << "really... stop with the insane clicking of these random buttons"<<endl;
}
}
cout << "Do you think tyler is hooooot??? (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> tylerishot;
if (tylerishot == "y"){
cout << "alrighty then... your a girl right? (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> girlright;
if (girlright == "y"){
cout << "we should like, totally go out sometime!! "<<endl;
}
else if (girlright == "n"){
cout << "umm... ok then... awkwardddd"<<endl;
}
else{
cout << "don't. push. the. wrong. button. again.!!!!!"<<endl;
}
}
else if (tylerishot == "n"){
cout <<"WHATT?!?! IM ABSOLUTELY 100% HOOTTT. get a life kid"<< endl;
}
else{
cout <<"STOP HITTING THAT BUTTON, JESUS CHRIST."<<endl;
}
cout << "Do you like justin bieber? (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> justinbieber;
if (justinbieber == "y"){
exit(0);
}
else if (justinbieber == "n"){
cout << "FINALY, SOMEBODY WHO'S HUMAN!"<<endl;
}
else{
cout << "WTF?! DO YOU LIKE HIM OR NOT... (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> justinbieber;
if (justinbieber == "y"){
cout <<"get a life..."<<endl;
system ("pause");
exit(0);
}
else if (justinbieber == "n"){
cout << "THANK GOD!!!!"<<endl;
}
else{
cout << "really? again? your getting booted."<<endl;
system ("pause");
exit(0);
}
}
cout << "do you like pancakes??? (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> pancakes;
if (pancakes == "y"){
cout <<"awesome you rock!"<<endl;
}
else if (pancakes == "n"){
cout << "you don't like pancakes??? where are you from? the moon?"<<endl;
}
else {
cout << "Can you please not hit the wrong button next time? It's quite annoying you know..."<<endl;
}
cout << "Do you like winter? (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> likewinter;
if (likewinter == "y"){
cout << "OEMGEE I ABSOLUTELY LOVE WINTER, WE HAVE SO MUCH IN COMMON )"<<endl;
}
else if (likewinter == "n") {
cout << "ewww... what do you like?\n(s) Summer\n(S) Spring\n(f) Fall" <<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> favseason;
if (favseason == "s"){
cout << "really, summer is your favourite... interesting. I hate that season "<<endl;
}
else if (favseason == "S") {
cout << "yeah, springs a pretty good season as well I guess..."<<endl;
}
else if (favseason == "f") {
cout << "Fall, thats an Ok season I guess... Playing in the leaves is pretty fun I guess."<<endl;
}
else{
cout << "Ok... DON'T PUSH THE WRONG BUTTON. I'm seriously going to exit(0); you...."<<endl;
}
}
else {
cout <<"STOP THAT"<<endl;
}
cout <<"Have you ever kissed Cody Miller? (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> kissedcody;
if (kissedcody == "y"){
cout <<"Please tell me your a girl...(y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> Cgirl;
if (Cgirl == "y"){
cout <<"oh... how interesting, I didn't know he's kissed YOU."<<endl;
}
else if (Cgirl == "n"){
cout << "oh... I'll be talking to him later"<<endl;
}
else {
cout << "are you going to stop hitting the wrong button any time soon?"<<endl;
}
}
else if (kissedcody == "n"){
cout <<"Well, I could've figured THAT out..."<<endl;
}
else{
cout<<"FOR **** SAKES STOP THAT..."<<endl;
}
if(Frestart (ITSASTRING, restart) == "y"){
restart = "y";
}
else
{
restart = "n";
}
}
while(restart == "y");
return 0;
}
[/php]
[php]
//variables.h
#include <string>
using namespace std;
int thisIsANumber; // used for random number
string yesOrNo; // used for favourite number
string likeShitTacos; // used for waffles
string BelgianOrEggos; // used for belgian or eggos
string strawberry; // used for strawberries and whipped cream on belgian waffles
string syrup; // used for syrup on belgian waffles
string ITSASTRING; // empty string, used for transfering variables
string firstname; // second string, used for first name
string lastname; // third string, used for last name
int age; // int, used for age
string randomword; // used for random word
int favouritenumber; // used for favourite number
string girlsorboys; // likes girls or boys
string boyorgirl; // is a boy or girl
string tylerishot; // am I hot? obviously...
string restart; // restart the game?
string girlright; // your a girl right?
string justinbieber; // you better not like justin bieber
string pancakes; // like pancakes?
string likewinter; // like winter?
string kissedcody; // ever kissed cody miller?
string Cgirl; // girl kissed cody right?
string favseason; // fav season
string computer; // like the computer
string boyORgirlfriend; // have a boyorgirlfriend
string girlORboyfriend; // boy or girlfriend?
string boyfriendname; // boyfriend's name
string girlfriendname; // girlfriend's name
string picklesandpopcorn; // like pickles and popcorn?
string eathair; // eat your hair?
string smoothies; // like smoothies?
string hotdogs; // like hotdogs?
string princesses; // like princesses?
[/php]
[php]
//functions.h
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
void Felse(){
cout << "that wasn't an answer...\n";
}
void test (string a, char c[40], char e[40]){
if(a == "y"){
cout << c << endl;
}
else if(a == "n"){
cout << e << endl;
}
else { Felse(); }
}
string Frestart (string ITSASTRING , string FFrestart){
cout <<"time to end this game... if you want "<<endl;
cout << "would you like to play again? (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> FFrestart;
if (FFrestart == "y"){ // if they want to restart, play again
cout << "alright, here we go!!!!"<<endl;
}
else if (FFrestart == "n"){ // if they don't ensure they don't
cout << "I'm going to ask again, just for safety's sake. Would you like to play again? (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> FFrestart;
if (FFrestart == "y"){
cout << "alright, I'm going to restart it for you"<<endl;
}
else if (FFrestart == "n"){
exit(0);
}
else {
cout << "sorry, what was that?\ndid you want to replay or not? (y/n)"<<endl;
getline (cin,ITSASTRING);
stringstream(ITSASTRING) >> FFrestart;
if (FFrestart == "y"){
cout << "alright, going to restart it for you"<<endl;
}
else{
exit(0);
}
}
}
return (FFrestart);
}
/*todo: add Fyes and Fno functions, use them in the test function. Re-name the test function to Fif.
Add Fyes, Fno and Felse header files to contain all the variables used for Fyes, Fno and Felse (variables used when calling the function in TBQ.cpp) */
[/php]
This is an extremely simple text based questionaire... Going to be adding a LOT more code. My todo list is located in the functions.h. The todo list is what I'll be doing on the next day. I make a new todo list every day.
*note, this is NOT glitchy code. It works perfectly fine. I do NOT need criticism, I will ignore it. This is my text based questionaire that I'll be making on my own. With a bit of help from others with the errors*
Just excited that after hundreds of errors (literally...) I figured em all out without any help and finished the hardest day of coding I've ever had. Use this code if you want, but please note it is NOT currently wrote for accesibility OR efficiency... very messy code, header files which aren't needed... but it's all getting cleaned up slowly