Please explain this code: #include #include using namespace std; int main() { char userInput[50]; cout << "Enter a word in lowercase letters: "; cin >> userInput; for (int i = 0; i <= strlen(userInput); i++) { userInput[i] = toupper(userInput[i]); } cout << userInput; return 0; }
Please explain this code: #include #include using namespace std; int main() { char userInput[50]; cout << "Enter a word in lowercase letters: "; cin >> userInput; for (int i = 0; i <= strlen(userInput); i++) { userInput[i] = toupper(userInput[i]); } cout << userInput; return 0; }
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Please explain this code:
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char userInput[50];
cout << "Enter a word in lowercase letters: ";
cin >> userInput;
for (int i = 0; i <= strlen(userInput); i++) {
userInput[i] = toupper(userInput[i]);
}
cout << userInput;
return 0;
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images