////////////////////////////////// // // Author : Wyatt Date : 1/1/2000 // Purpose: To ask a user's name and to say hello // Design: Ask Name // Store name // greet user using stored name // // File: Hello.cpp ///////////////////////////////// #include using namespace std; int main ( ) { // Local Data string firstName; //input variable // Enter letters and display message. cout << "Enter your first name and press return: "; cin >> firstName; cout << "Hi " << firstName << '.' << endl; cout << "We hope you enjoy studying C++." << endl; return 0; } //====================================================================== //====================================================================== /* File: Hello.c Author : Wyatt Date : 1/1/2000 Purpose: To ask a user's name and to say hello Design: Ask Name Store name greet user using stored name */ #include int main() { /* Local Data */ char firstName[12]; /*input variable*/ /* Enter letters and display message. */ printf ("Enter your first name and press return: "); scanf ("%s", &firstName); // need address (here could drop &) printf("hello world, %s\n" , firstName); return 0; }