Click here for important information about

C++ Q and A program

Hewlett-packard / Pavilion touchsmart amd a...
February 13, 2014 at 12:25:40
Specs: Windows 7, 8GB
So i have it so that the program prompts the user to say something, and sets it to a variable, but how do i get the program to check if the variable contains "Hi" for example and then have it reply with "Hello"?

For example:

#include <iostream>

using namespace std;
int apple;
int main(){
cout << "What do you want to talk about?" << endl;
cin >> apple;
if (apple="Hi"){
cout << "Hello" << endl;
Then after responding it will expect a reply, how can I do that?

message edited by Danm992

See More: C++ Q and A program

February 13, 2014 at 12:39:47
It sounds as if you need to learn C++ first. You already know the algorithm, as you've done it in batch, so it's simply a mechanical translation into another language.

There are, of course, far better ways of doing this in C++ but it doesn't sound as if your stage of learning is up to that yet, so I won't confuse you with the alternatives.

Report •
Related Solutions

Ask Question