Engineering Curriculum at Coronado High School: 2010 - 2014

Tuesday, September 13, 2011

"I'm Sorry Dave, I'm Afraid I Can't Do That..."




This is a follow on for when we get back to programming next. We can continue from where we were with our "Hello World!" C++ program and modify it to replicate the best artificial intelligence that our space program can buy.

Challenge:
Craft a program that functions like the frustratingly perfect HAL 9000 from Stanly Kubric's seminal movie 2001.

Specifically:
(1pt) - Prompt the user to enter their name (see tips below)
(1pt) - Ask the user what they'd like to have HAL 9000 do and always reply with "I'm sorry (name entered), I'm afraid I can't do that"






A few thoughts that might help out:

Google C++ cin to understand how you can use the cin command to input text.

Before the main () function with the other #include place the following:
#include <string>

Inside the main () function you could use the following:
string user_input; //creates a string (text) variable named "user_input"
getline(cin, user_input); //the getline function can be used to enter a string (text) for the user_input variable

No comments:

Post a Comment