Ok so I'm just going to copy paste what I've got so far below, it's really simple so there shouldn't be any issues.
#include "stdafx.h"
#include <iostream>
#include <string>
#include <Windows.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
std::string name;
std::cout << "Hello! What is your name?\n";
std::cin >> name;
std::cout << "Hello, " << name << "! How are you today?\n";
std::string mood;
std::cin >> mood;
std::cout << "Sorry, didn't hear that. Are you 'Sad', 'Mad', or 'Happy'?\n";
int jerky;
while (jerky=0){
std::cin >> mood;
string sad = "Sad";
string mad = "Mad";
string happy = "Happy";
if (false(mood == sad)){
std::cout << "Aww, that's too bad! Why?\n";
jerky = 1;
}
else if (false(mood == mad)){
std::cout << "Who're you mad at? What'd they do?\n";
jerky = 2;
}
else if (mood == happy){
std::cout << "What's got you in such a good mood?\n";
jerky = 3;
}
else {
jerky = 0;
std::cout << "Sorry, didn't quite hear you! Make sure you capitalize just the first letter and were using one of the three choices.\n";
}
}
string info;
std::cin >> info;
std::cout << "Interesting. I'm afraid we can't talk about that anymore, however, because I have a mission for you!\n";
Sleep(3000);
std::cout << "Press the enter key to continue.";
getchar();
return 0;
}
The issue I'm currently working on is the while loop. When I type in a correct answer as the option, rather than printing the rest requested in the if statement within the while loop, it just skips straight to the "Interesting..." line (near the bottom). Help? PS It's not finished, only looking for help with that issue.
Aucun commentaire:
Enregistrer un commentaire