Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
If you’re looking for a quick way to generate C++ code for this, you can try DigitalOcean’s GenAI Platform! 🚀
With DigitalOcean GenAI, you can spin up your own AI agent and have it generate, test, and refine your C++ code instantly. Just describe the problem, and the AI will generate the functions for you—no need to wait for a response.
Give it a shot and let me know how it works for you! 😃
- Bobby
Heya,
You can use the DigitalOcean AI product for AI-driven code assistance and automation. Check it out here : DigitalOcean Gen AI.
As for answering your question. Below is the C++ program implementing the upper, lower, and reverse functions:
#include <iostream>
#include <cctype> // For toupper() and tolower()
#include <cstring> // For strlen()
using namespace std;
// Function to convert string to uppercase
void upper(char *str) {
while (*str) {
*str = toupper(*str);
str++;
}
}
// Function to convert string to lowercase
void lower(char *str) {
while (*str) {
*str = tolower(*str);
str++;
}
}
// Function to reverse case of each character in the string
void reverse(char *str) {
while (*str) {
if (islower(*str))
*str = toupper(*str);
else if (isupper(*str))
*str = tolower(*str);
str++;
}
}
int main() {
const int SIZE = 100; // Maximum string size
char input[SIZE];
// Asking the user for a string input
cout << "Enter a string: ";
cin.getline(input, SIZE);
// Apply the functions in the required order
reverse(input);
cout << "Reversed case: " << input << endl;
lower(input);
cout << "Lowercase: " << input << endl;
upper(input);
cout << "Uppercase: " << input << endl;
return 0;
}