0

Solve the given problem statement

: Write a program that asks the user's name, and then greets the user by name. Before outputting the user's name, convert it to upper case letters. For example, if the user's name is Fred, then the program should respond "Hello, FRED, nice to meet you!".

26th Mar 2017, 4:12 PM
abhijit kushwaha
abhijit kushwaha - avatar
3 Antworten
+ 11
here in js:(pretty short) alert ("Hello "+prompt ("Please enter your name").toUpperCase () + ", nice to meet you!");
26th Mar 2017, 6:36 PM
Kamil
Kamil - avatar
+ 2
string convertToUpper(string Name) { for (int i = 0; i < Name.length(); i++) { char letter = Name[i]; Name[i] = toupper(letter); } return Name; } int main() { string name; getline(cin, name); cout << "Hello, " << convertToUpper(name) << ", nice to meet you!" << endl; return 0; } This is really simple and doesn't check for a lot of things it should, but it does what you asked. Happy Coding!
26th Mar 2017, 4:52 PM
Zeke Williams
Zeke Williams - avatar
+ 1
Python: name = input() print("Hello", name.capitalize()+",", "nice to meet you!")
26th Mar 2017, 7:04 PM
Martian1oh1
Martian1oh1 - avatar