Click here to Skip to main content
15,892,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to get if the person says no it will do a repsonse if he says yes or I will do it, or something in that matter it will give a different response.
C++


C++
#include <iostream>
#include <string>
int main()
{
using namespace std;
    cout << "What is your name son!?" << endl;
    string name;
    cin >> name;
    cout << name << ", hmm, strange name, never mind that!" << endl;
cout << "I have a quest for you, are you interested?"
  char I will.;
       I will not.;
    string I will.;
    string I will not.;
    cin >> I will.;
    cin >> I will not.;
if (I will not.) cout << "Okay then, be gone mortal!" << endl;
if (I will.) cout << "I need you to save the villagers, in the east from a rising golblin attack to prove to me you are worthy." << endl;
return 0;
}


What I have tried:

I tried doing this for around 30 mins, I just don't know what to do?
Posted
Updated 22-Sep-16 8:02am
Comments
jeron1 22-Sep-16 13:27pm    
Google c language variable name rules, then google if statement rules. Seriously though try and get a decent book and go through the examples carefully.
Member 12753942 22-Sep-16 14:46pm    
Thanks I'm trying my best for doing this only for a day now.
Trying to learn on my own but I can't do that with all things I assume, thanks for the tips :)))

You need to learn the right syntax in C++. Your code doesnt like the compiler.

tips in code:

C++
char I_will;//never ever use space in vars or point
string I_will = "I will."//declare the string and fill it;
if (compare( I_will, "I will not.") == 0 ) //compare ( result is 0 for true) => tutorial


Take some lessons at this fine string tutorial.
 
Share this answer
 
You need yo learn seriously C++ and its syntax.

Here is links to references books on C and C++ by the authors of the languages. Note than C is the ancestor of C++, so knowing C is always useful with C++.
The C Programming Language - Wikipedia, the free encyclopedia[^]
https://hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf[^]
http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf[^]

C++ Programing Language[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900