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!".
3 Réponses
+ 11
here in js:(pretty short)
alert ("Hello "+prompt ("Please enter your name").toUpperCase () + ", nice to meet you!");
+ 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!
+ 1
Python:
name = input()
print("Hello", name.capitalize()+",", "nice to meet you!")