Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- // Convert lowercase letters to uppercase.
- int main()
- {
- string word; // This is the input.
- cout << "Enter a word:" << endl;
- cin >> word; // Get the word from the user.
- // Check each letter.
- for (size_t i = 0; i < word.size(); ++i)
- {
- // If the letter is lowercase,
- if (word[i] >= 97 && word[i] <= 122)
- {
- // Change it to uppercase.
- word[i] = word[i] - 32;
- }
- }
- // Display the converted word.
- cout << word << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement