After the following statements are executed, val should contain a capital letter. Write a while loop to follow the given code that will repeatedly reprompt and reread input if this is not the case. (note that a capital letter is anything >='A' and <= 'Z') char val; cout<<"Enter a capital letter\n"; cin>>val;
Q: C++ PROBLEM. PASTE INDENTED CODE Write a loop to request integer values until a positive…
A: code:-- #include <iostream>using namespace std; int main(){ // to store number enterd by…
Q: hallenge Problem (pyhton) T E S T S C O R E S Write a program that…
A: Program Approach: 1- As mentioned in the assignment created the main function. 2- def keyword used…
Q: can I know the pseudocode and flowchart for this programm..thank you
A: In the question, we are asked to write a pseudo code and flow chart of the given code. Given Code:…
Q: the output of the following for loop is 25 18 What are the loop continuation condition and…
A: Please find the answer below :
Q: 8. _________________ loop structure is best when the number of iterations is known in advance.
A: for loop: A repetition control structure that gets executed for the specified number of times. for…
Q: Please create a flowchart for this code: #include using namespace std; void display(int row) {…
A: Flow chart is a step by step process in which sequence of steps are connected with the flows. In the…
Q: /* DOUBLE ALTERNATIVE The if-else if statement A bicycle salesperson was offered a choice of wage…
A: #include <stdio.h>int main(){ int sales,p1,p2,p3; //p1=plan1 salary, p2=plan2 salary,…
Q: please use C++ programming language and please include the comments in the code.
A: a) line numbers that will execute first are: 7,8,9,17,18,19,10,11 b) Function prototype: void…
Q: A FLOWCHART
A: Steps to Create: Although it may seem complicated to create a flow flowchart, flow chart maker tools…
Q: Fill-in-the-Blank The statement or block that is repeated is known as the __________ of the loop.
A: Lets see the solution.
Q: the while do program does not add the numbers correctly. Correct the program by writing as a while…
A: #include <iostream> using namespace std; int main(){ int total = 0, count =0, number=0;…
Q: debug this code
A: Below i have debugged the program:
Q: How many times will the value in y be displayed in the following program segment ?
A: Output:…
Q: FILENAME: SURNAME_CONTROL STRUCTURES USING SWITCH-CASE Case Problem Ask the user to select an item…
A: Given: To implement a menu driven program. switch the item code and calculate and display details…
Q: *** ***** ******* The second ric ** *** **** ***** ** ** *** ***
A: #include<iostream> using namespace std; int main(){ char ch; //the fill character int…
Q: 4) In Selection Statement, the end statement is given multiple times in O Multiple elseif O elseif O…
A: Answer : Nested if is the correct answer.
Q: P| Understanding if Statements In this lab, you complete a prewritten C++ program for a carpenter…
A: Given: // HouseSign.cpp - This program calculates prices for custom made signs. #include…
Q: QUESTION 1 Complete the following program that finds the sum and average of the numbers from 4 until…
A: The program for finding the sum and average is provided below:
Q: NewMultiply.cpp - This program prints the numbers 0 through 10 along // with these values multiplied…
A: The, code has given below:
Q: All e or false O O O . O When coding a while) statement, some C++ programmers include parentheses…
A: Answer:-1) The correct option is True Explanation: A while loop is always used to check the…
Q: The following loop will be repeated int j=10; while (j >= 0) times. { cout << 2 *j<< '\t' ; J-= 2; A…
A: Ans: The following loop will be repeated times. int j=10; while(j >= 0) { cout << 2 * j…
Q: int m; for (m=20;m>=0;m-=2) { m=m/2-1; printf("%d ",m); }
A:
Q: Intermediate Code The following statement is known: A = - A * (A + B ) - (B – C) / D Please make:…
A: Quadruples The quadruples have four fields to implement the three address code. The field of…
Q: must be done using a while loop with nested statements Write a Python program that calculates the…
A: NOTE Below is the answer for the given question. Hope you understand it well. If you have any…
Q: Rewrite the following if statement into conditional statement i. if (x > 100) a = 0; elsea = 1; ii.…
A: if (x > 100){a = 0;}else{ a= 1;} if (temp > 45){ population = base * 10;} else{ population =…
Q: It is possible to create a variable inside a function. A) False B) True C) True, but only after…
A: Generally, when a variable is created inside a function, that variable is local, and it can be only…
Q: Write a complete C++ program that: 1) Prompts the user to enter from the keyboard two numbers of…
A: std::setw : Set field width; Sets the field width to be used on output operations. std::setfill :…
Q: c++ Write the program that has the following menu. This menu should continue to come up until the…
A: Description: Create a class named User that stores the name, phone number, and salary. Create two…
Q: (Inactive C:\TCWIN\BIN\NONAMEO0. EXE) Enter a number between 1 and 9 >-1 Sorry your number is not…
A: Programming instructions: Include necessary header files. In the main, declare required…
Q: Program Grade prints appropriate message based on a grade read from the keyboard.
A: We need to add the logical expression in the if statement for checking whether the grade entered is…
Q: Look at the following code segment, what will the while loop display on the screen? int x = 0; while…
A: The loop has a condition that x should be less than 10. x starts from 0 and is incremented with…
Q: modify code below to loop until user enters 0 0 0 // Recoding program to sort three numbers// by…
A: The given C++ program is // Recoding program to sort three numbers// by Dante Garces#include…
Q: Write a do while loop that uses the loop control variable to take on the values 0 through 10. In…
A: numberCounter will move from 0-10 byTwo will have number multiplied by 2 byTen will have number…
Q: A restaurant in Amman provides 2 offers for customers: o Regular Meal: The base price of the meal is…
A: The program reads two inputs from the user, an extra sandwich and an extra drink. Four functions are…
Q: Processing Requirements Create a variable of type ofstream inside main for the output file. Use this…
A: METHOD USED :- All three functions were defined as specified. Made use of app(append mode ) in…
Q: 3. Intermediate Code The following statement is known: A = - A * (A + B ) - (B – C) / D Plrase make:…
A: The following statement is known:A = - A * (A + B ) - (B – C) / D
Q: / This program displays a hot beverage menu and prompts the user to // make a selection. A switch…
A: The, code has given below;
Q: How many times will the for-loop be executed? #include 2 using namespace std; 3 int main() { for…
A: The solution for the above given question is given below:
Q: Q/if| Integer variable, when the following code is executed, the print output
A: I is an integer value. for(I=1;I++<=4;) Loop runs for I value 1 to 4 Here I is post increment so…
Q: C-code blocks The program displays the numbers 50, 45, 40, … 10, 5, 0 using a while loop. Write…
A: The Answer is
Q: 3. After the following statements are executed, score should contain a value from zero through 100.…
A: Approach We will use while loop along with logical OR (||) operator to check the value of score that…
Q: #include using namespace std; int main() { int score; char grade; // input an…
A: The given Code is: #include <iostream> using namespace std; int main() { int score; char…
Q: Using C# in Microsoft Visual Studio* create an application that lets the user enter a nonnegative…
A: The C# code is given below with an output screenshot
Q: Write a loop that reads positive integers from standard input and that terminates when it reads an…
A: Please find the answer below :
Q: 7. _______________________ loop structure controls the entry into the loop.
A: Actually, loops are used to repeat the statements.
After the following statements are executed, val should contain a capital letter. Write a while loop to follow the given code that will repeatedly reprompt and reread input if this is not the case. (note that a capital letter is anything >='A' and <= 'Z')
char val;
cout<<"Enter a capital letter\n";
cin>>val;
logic: -
declare val
use while loop and put always true condition in it.
read val
check if val >=‘A’ && val<=‘Z’
break
end.
Step by step
Solved in 3 steps with 1 images
- #include <iostream> using namespace std; int main() { int num = 1; while (num < 30) { cout << num << “ “; num = num + 5; } } The fourth number displayed is ______// This program illustrates the use of a sentinel in a while loop. // The user is asked for monthly rainfall totals until a sentinel // value of -1 is entered. Then the total rainfall is displayed. #include using namespace std; int main() { // Fill in the code to define and initialize to 1 the variable month float total = 0, rain; cout << "Enter the total rainfall for month " << month << endl; cout << "Enter -1 when you are finished" << endl; // Fill in the code to read in the value for rain // Fill in the code to start a while loop that iterates // while rain does not equal -1 { // Fill in the code to update total by adding it to rain // Fill in the code to increment month by one cout << "Enter the total rainfall in inches for month " << month << endl; cout << "Enter -1 when you are finished" << endl; // Fill in the code to read in the value for rain } if (month == 1) cout << "No data has been entered" << endl;…change while to do #include <iostream>using namespace std;int main(){int n1,high=-1,low=101,tot=0;double avg=0; while (true)// condition always true{// body of loopcout <<"enter a grade,-1 to stop"<<endl;cin >> n1;if (n1==-1)break;++tot;avg+=n1;if (high < n1)high=n1;if (low >n1)low=n1; } //end loop cout<<"Total number of grades is "<<tot<<endl; // prints total number of grades that were inputcout<<"The highest grade is "<<high<<endl; // prints the highest gradecout<<"The lowest grade is "<<low<<endl; // prints the lowest gradeif (tot > 0)cout<<"The average grade is "<<avg/tot<<endl; //calculates the average grade return 0;}
- Q2/ The value of Y is 1 3 5 Y = - X X³ X5 Xn the following code calculates the value of Y, read the code carefully and program the same idea using the while loop. #include #include int main() { double x,y; int n; cout >x>>n; int i,k; k=0; y=0; for (i=1;iUsing C++, code if the inputted value is not a number the program will loop the question and ask againPre-Lab 02: Write a menu driven C++ program that uses do- while loop with a switch-statement to evaluate whether the user wants to find a square of a value, find the cube of a value, or quit the program. After the user makes their choice, the required numbers needed for the operation are input and the user's result of choice is computed and printed. The program ends when the user chooses to quit from the program. If the user entered an invalid choice print an ERROR message and show the menu again. +,II This program displays a hot beverage menu and prompts the user to Il make a selection. A switch statement determines Il which item the user has chosen. A do-while loop repeats until I/l the user selects item E from the menu. #include #include SITY OF using namespace std; int main() I Fill in the code to define an integer variable called Il number, a floating point variable called cost, Il and a character variable called beverage bool validBeverage; cout <« fixed << showpoint << setprecision(2); do cout << endl << endi; cout << "Hot Beverage Menu" « endi<< endl; cout << "A: Coffee $1.00" < endi; cout<< "B: Tea S.75"<// LargeSmall.cpp - This program calculates the largest and smallest of three integer values. #include <iostream> using namespace std; int main() { // This is the work done in the housekeeping() function // Declare and initialize variables here int largest; // Largest of the three values int smallest; // Smallest of the three values // Prompt the user to enter 3 integer values // Write assignment, add conditional statements here as appropriate // This is the work done in the endOfJob() function // Output largest and smallest number. cout << "The largest value is " << largest << endl; cout << "The smallest value is " << smallest << endl; return 0; }Part 4: Working with Logic Errors: Working with Logic Errors // This program takes two values from the user and then swaps them// before printing the values. The user will be prompted to enter// both numbers.// Place your name here#include <iostream>using namespace std; int main(){float firstNumber;float secondNumber;// Prompt user to enter the first number.cout << "Enter the first number" << endl;cout << "Then hit enter" << endl;cin >> firstNumber;// Prompt user to enter the second number.cout << "Enter the second number" << endl;cout << "Then hit enter" << endl;cin >> secondNumber;// Echo print the input.cout << endl << "You input the numbers as " << firstNumber<< " and " << secondNumber << endl;// Now we will swap the values.firstNumber = secondNumber;secondNumber = firstNumber;// Output the values.cout << "After swapping, the values of the two numbers are "<<…Recommended textbooks for youDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag…Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill EducationDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag…Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education