5. convertToUpper - Given an input string, the function converts all alphabetic characters to uppercase. Write the new string into an output file called Upper.txt and return true. If the input string is empty just return false. The function header is: bool convertToUpper(const string & st)

Answers

Answer 1
Answer:

Answer:

#include <iostream>

#include <cstring>

#include <fstream>

using namespace std;

bool convertToUpper(const string &st);

int main()

{

string s;

cout << "Enter the string: " << endl;

getline(cin, s);

convertToUpper(s);

return 0;

}

bool convertToUpper(const string &st) {

if(st.length() == 0) {

return false;

} else {

ofstream myfile;

myfile.open ("Upper.txt");

for(int i=0;i<st.length();i++) {

if(st[i]>='a' && st[i]<='z') {

myfile << (char)toupper(st[i]);

} else {

myfile <<st[i];

}

}

myfile.close();

}

 

}


Related Questions

Technician A says a 2:1 gear ratio doubles the amount of torque. Technician B says a 2:1 gear ratio reduces the speed by half. Which technician is correct? A. Technician A onlyB. Neither Technician A nor Technician BC. Both Technician A and Technician BD. Technician B only
If you are looking for a keyboard to project from a device to a flat surface, which of the following would you use?
What is the center of mass of the assembly? a) X=‐11.05 Y=24.08 Z=‐40.19 b) X=‐11.05 Y=‐24.08 Z=40.19 c) X= 40.24 Y=24.33 Z=20.75 d) X= 20.75 Y=24.33 Z=40.24
Caleb Co. owns a machine that had cost $42,400 with accumulated depreciation of $18,400. Caleb exchanges the machine for a newer model that has a market value of $52,000. 1. Record the exchange assuming Caleb paid $30,000 cash and the exchange has commercial substance. 2. Record the exchange assuming Caleb paid $22,000 cash and the exchange has commercial substance.
What is the magnitude of the largest positive value you can place in a bool? a char? an int? a float?

Choose the best collection for each situation.You need to keep a record of the ages of the last 50 customers visit a restaurant. As new customers come in you delete the age that has been in the list the longest.

You need to store the GPS coordinates of the hospitals in a state in order to find the nearest hospital for ambulance helicopters.

You write a loop to save anywhere from 10 to 100 values from a user. You will pass the collection to a function to find the average.

Answers

Answer:

Deque: You need to keep a record of the ages of the last 50 customers visit a restaurant. As new customers come in you delete the age that has been in the list the longest.

Tuple: You need to store the GPS coordinates of the hospitals in a state in order to find the nearest hospital for ambulance helicopters.

List: You write a loop to save anywhere from 10 to 100 values from a user. You will pass the collection to a function to find the average.

Explanation: Just got the results back no thanks to the guy above

Write out the base sequence that is added directly after the primer. In order for Moodle to correctly grade this question, write only the letters representing the bases, write your answer in 5' to 3' direction, and do not have any spaces between the letters and do not label the 5' and 3' ends.

Answers

Answer:

see explaination

Explanation:

please kindly see attachment for the step by step solution of the given problem.

Is printer an input device​

Answers

Answer:

Printer is a output device.

Explanation

It takes the input from the user and gives the output in the form of a texted document. It is called hard copy of our document. Printer is Output and Scanner is input Devices.

.Although SQL is a language, you donât use it to write applications? (true, false)

Answers

Answer:

True

Explanation:

SQL stands for structured  query language , which is used to query Relational Database Management systems like SQLServer. This is not for writing applications like business layer where we use some programming languages.SQL is meant for data layer to perform CRUD operations against database.

CRUD operations :

Create

Read

Update

Delete

we can perform above operations on database by using SQL query language

On a piano, each key has a frequency, and each subsequent key (black or white) is a known amount higher. Ex: The A key above middle C key has a frequency of 440 Hz. Each subsequent key (black or white) has a frequency of 440 * rn, where n is the number of keys from that A key, and r is 2(1/12). Given an initial frequency, output that frequency and the next 3 higher key frequencies. If the input is 440, the output is: 440 493.883 523.251 554.365.Note: Include one statement to compute r = 2(1/12) using the pow function, then use r in the formula fn = f0 * rn. (You'll have three statements using that formula, different only in the value for n).

Answers

Answer:

sample output

Enter f0 = 440

440.0,466.1637615180899, 493.8833012561241,

523.2511306011974,  554.3652619537443

Explanation:

import math                                 // math library  

def RaiseToPower():                 //  RaiseToPower method

 r = math.pow(2,1/12)               //r = 2^(1/12)

f0 = float(input('Enter f0 : '))     //input from user

                                               

//a key has a frequency,sy f0

                                                                                                                                     

print(f0,end=' ')                      //Display statement

 for n in range(1,5):                //Iterate the loop up to  the next 4 higher key Hz

n = f0 * math.pow(r,n)         //calculate the fn value

print(fn,end=' ')                   //Display statement

 RaiseToPower()                //Call RaiseToPower method  

                                         

 

         

     

       

1) The program reads an integer, that must be changed to read a floating point. 2) You will need to move that number into a floating point register and then that number must be copied into an integer register. 3) You will need to extract the exponent from the integer register and stored in another register. 4) You will need to insert the Implied b

Answers

Answer:

1. Get the number

2. Declare a variable to store the sum and set it to 0

3. Repeat the next two steps till the number is not 0

4. Get the rightmost digit of the number with help of remainder ‘%’ operator by dividing it with 10 and add it to sum.

5. Divide the number by 10 with help of ‘/’ operator

6. Print or return the sum

# include<iostream>

using namespace std;

/* Function to get sum of digits */

class gfg

{

   public:

   int getSum(float n)

   {

   float sum = 0 ;

   while (n != 0)

   {

    sum = sum + n % 10;

    n = n/10;

   }

return sum;

}

};

//driver code

int main()

{

gfg g;

float n = 687;  

cout<< g.getSum(n);

return 0;

}

Explanation: