![Werkrat2756](/avatars/25264.jpg)
Werkrat2756
21.12.2020 •
Computers and Technology
Write a program that prompts the user to input a string and outputs the string in uppercase letters. (Use dynamic arrays to store the string.)/*Your code from Chapter 8, exercise 5 is below.Rewrite the following code to using dynamic arrays.*/#include #include #include using namespace std;int main(){char str[81];int len;int i;cout << "Enter a string: ";cin.get(str, 80);cout << endl;cout << "String in upper case letters is:" << endl;len = strlen(str);for (i = 0; i < len; i++)cout << static_cast(toupper(str[i]));cout << endl;return 0;}
Solved
Show answers
More tips
- C Construction and repair How to Choose the Best Underfloor Heating?...
- C Computers and Internet How to Get Rid of Windows Genuine Check?...
- C Computers and Internet War of Social Media: Which Platform is the Leader?...
- H Health and Medicine How to Treat the Flu: A Comprehensive Guide...
- O Other What is a Disk Emulsifier and How Does it Work?...
- F Family and Home What does a newborn need?...
- F Family and Home Choosing the Right Car Seat for Your Child: Tips and Recommendations...
- F Food and Cooking How to Get Reconfirmation of Registration?...
- C Computers and Internet How to Get Rid of Spam in ICQ?...
- A Art and Culture Who Said The Less We Love a Woman, the More She Likes Us ?...
Answers on questions: Computers and Technology
- P Physics There are many factors that influence the strength of an electromagnet. what could be done to make the electromagnet stronger?...
- E English Answer with your favorite movie quote for free points and brainliest!!!...
- H History Which event occurred as a result of the war of 1812? a. americans gained a renewed sense of pride in their country. b. president james madison was impeached for war crimes. c. the...
- M Mathematics Solve the equation x+1=2x for x. square both sides of the equation, and verify that your solution satisfies this new equation. show that −1/3 satisfies the new equation but not the...
Ответ:
Following are the code to this question:
#include <iostream>//defining header file
#include <cstring>//defining header file
#include <cctype>//defining header file
using namespace std;
int main()//defining main method
{
char *str = new char[80];//defining char variable for input value
char *str1=new char[80]; //defining char variable for storing the output of string
int len,i;//defining integer variable
cout << "Enter a string: ";//print message
cin.get(str, 80);//use get method to input string value
cout << "String in upper case letters is:"<< endl;//print message
len = strlen(str);//using len variable to store string length
for (i = 0; i <len; i++)//defining for loop for generating sting into upper case
{
*(str1+i)=toupper(*(str+i)); //generating upper case string of input string.
}
for(i=0;i<len;i++)//defining for loop for print value
{
cout<<*(str1+i); //displaying upper case string value.
}
return 0;
}
Output:
Enter a string: database
String in upper case letters is:
DATABASE
Explanation:
In the given code two char array "str and str1", and two integer variable "i and len", in the next step, the str array is used the get method to store array value and it defines the two for loop, in which the first string is used len variable to count the length of the string length and in the second for loop, it converts the string value into upper case and prints its value.
Ответ:
22
Explanation:
1. We are going to have at hand 32 Enqueue Operation, with 10 from front and 15 dequeue and 5 empty queue operation
2. You dequeued total number of 15-5 =10 elements since 5 dequeue did not change the state of the queue, so invariably 10 dequeue is done.
3. Next is to enqueued a total of 32 elements.
Enqueue Operation do not change the state(and Size) of the queue, and can be ignored.
4. To arrive at the Total Size of queue, we will have 32-10 = 22 at the end
Answer : 22 because its a 5 dequeue Operations.