Title: Talking Console
Description: My first REAL program!
shadow382 - May 22, 2005 07:06 PM (GMT)
This is my first REAL program, besides a hello world program. :lol:
It will ask questions about you, and then respond depending on how you answered. I am trying to get it so you can make multiple answers, but I can' get it to work. Can someone help me with this? It was working last night, then I get up today, and it wont work. Well here's the code...
| CODE |
/////////////////////////////////////////// //// Talking Program V1.0 //// By Shadow382 //// V1.0 May 22, 2005 //// My first REAL program made by myself! //////////////////////////////////////////
#include<iostream> using namespace std;
main() { string name; string howdoin; string yourage; string talkalot; string goodtalkin; cout<<"Hi my name is Console, what's your name? "; cin>>name; cout<<"\nHi "<<name<<", how are you doing today? "; cin>>howdoin; if (howdoin==("good")) { cout<<"That's great! I'm doing good today also!"; } else { cout<<"Awww. Too bad! I'm doing pretty good today!"; } cout<<"\n\nHow old are you (Use letters please, no numbers!)? "; cin>>yourage; if (yourage==("sixteen")) { cout<<"Me and you are the same age! Awesome!"; } else { cout<<"Oh, I'm sixteen!"; } cout<<"\n\nDo you talk alot to people? "; cin>>talkalot; if (talkalot==("yes")) { cout<<"Ooh cool, I do too!"; } else { cout<<"Ooh, I like to talk to people, I get lonely!"; } cout<<"\n\nWell it's been good talking to you, have you enjoyed talking to me? "; cin>>goodtalkin; if (goodtalkin==("yes")) { cout<<"Thanks, I'd like to talk to you again! Well bye!\n\n"; } else { cout<<"Well your kind of rude, dont you think? Well bye!\n"<<endl; } system("pause"); } |
So can someone please help me make it so you can answer it differently? As soon as that is done, this program will be done. :D
I know this is not anything advanced, but I think it's good for a first program (seeing as how I haven't really read but about 2 days of a C++ tutorial).
*EDIT* Also I need it so you can enter a number as your age, and not have to type it. But when I tried all I got was errors, can someone help me with this also?
-Shadow382
ih8censorship - May 22, 2005 08:20 PM (GMT)
a good idea would be making it so they yes/no arent case sensitive. i dont know how to do it with std::string but with char* you can use a function i think its called tolower that will make everything lowercase so you can check it with a lowercase string. but ya thats not bad :)
shadow382 - May 22, 2005 08:38 PM (GMT)
That's a good idea. I was worndering how I would do that, so i'll get started on it. I have decided to add ALOT more to it, like a claculator, and more. When it's done you will be able to tell it what you want to do, and it'll respond. I think this will be good practice for me while learning C++. Thanks for the reply!
-Shadow382
donprogc++ - May 22, 2005 09:49 PM (GMT)
If you ever learn winsock you can make this into an irc bot :)
shadow382 - May 22, 2005 10:19 PM (GMT)
| QUOTE (donprogc++ @ May 22 2005, 09:49 PM) |
| If you ever learn winsock you can make this into an irc bot :) |
I was worndering how I would make one of those. I may try doing that, once I learn enough. It'd be cool to have my own bot, that I made. :D
-Shadow382
aaron7215 - May 22, 2005 10:50 PM (GMT)
Here is a topic in the gmc forums about intelligent chatbots, not just canned responses like this one(not saying this is bad), but here is the link:
http://forums.gamemaker.nl/index.php?showtopic=100083
shadow382 - May 23, 2005 05:48 AM (GMT)
Ok I'll look over that, and see what I can find out.
-Shadow382 :dj:
C-Man - May 23, 2005 11:52 AM (GMT)
hey how about you get on our irc channel
shadow382 - May 24, 2005 01:11 AM (GMT)
How do I goto the IRC channel?
-Shadow382 :dj:
C-Man - May 24, 2005 05:19 AM (GMT)
shadow382 - May 24, 2005 06:24 AM (GMT)
Ok thanks, I'll check that out!
-Shadow382 :dj:
Rmstn1580 - December 5, 2005 05:26 AM (GMT)
Your code works fine for me... I see no errors in it.
Viper - December 5, 2005 02:45 PM (GMT)
AquaFox - December 5, 2005 06:05 PM (GMT)
*Bump*
Oops Viper sorry I forgot to apply what you said in your post.
BTW you can object orient that. As in Replies.goodposts(); blah blah.