3- How many the number of errors in the following sub_program? Hincludeciostream.h> void main() intnum, sum - 1; for (int i = 1, i <= 10, i ++ ) cout<<"enter your number: “; cin>>num; if ( num> 0) sum = sum + num; cout<<"the sum is: << sum;} A) 3 B) 4 C) 5 D) 7 E) None of the above
Q: Now, modify it to do the following: modify the while loop to utilize tolower() or toupper().
A: Hi There, Please find your solution below, I hope you would find my solution useful and helpful. I…
Q: #include #include void LineFunc(void); void main() { int a, b; printf("Enter a :"); scanf_s("%d",…
A: The program after compilations gives an error that is So the error in this has occurred due to…
Q: convert this into #include using namespace std; int main() { int A,B; cout>A>>B; if (A>B)…
A: #include <stdio.h>using namespace std;int main(){ int A, B; printf("Input the values…
Q: None
A: Coded in C++.
Q: Fix it please #include using namespace std; int main()
A: include<iostream>using namespace std;int main(){char item1[20]="Fresh Milk",…
Q: Given the following code and output: int a[] = {10, 20, 30, 40}; cout << a << endl; Example Output…
A: Please find the answer to the above question below:
Q: Pass the first parameter by reference and the second parameter by value. 1 char mein ( int c, char…
A: Given code: char mein(int c, char i) { c=50; i= (char) c; cout<< (int)c+i<<endl; return…
Q: #include #include main() { int m, sum = 0, counter = 0; int first = 2147483647, second = 2147483647,…
A: C++ Code with some corrections: #include<stdio.h> #include<stdlib.h> using namespace…
Q: #include using namespace std; int main() { int N,Prime,i=1,n; cout>"%d",&N; do { Prime=0; n=1; do {…
A: The program is written in C++. Check the program screenshot for the correct indentation. Please…
Q: C programming int access () { char name [10]; int pin; int i, count, try; FILE *fp=…
A: A flowchart is a step by step diagrammatical representation of the program.
Q: int G=12; void Test(int& c) { c=c+5; ++G; cout<<c<< " "<<C int main() { int x=5,G=8; cout<<x<<" "<<G…
A: Q
Q: #include using namespace std; int main(){ int n, k, i, j, sum=0; cout>n; cout>k;…
A: Code: import java.util.Scanner;public class Main{ public static void main(String[] args) {…
Q: Task 4: Determinant There are several ways to compute the determinant of an n x n matrix. In this…
A: Algorithm: Start Define a function called compute_det that takes a 2D array of integers and an…
Q: using namespace std; int main) int find[) = [1, 2, 3, 4); int "p = (find + 1); %3D cout << *find +…
A: The output is option second which is 10.
Q: Find the output = int a = 10; do{cout 20) { break; }} while ( a < 20 )
A: 1 2 3 4 5 6 int a = 10; do { cout << "value of a:"<<a<<endl; a = a*1;…
Q: Now, modify it to do the following: Modify the while loop to utilize tolower() or toupper(). Add…
A: So for first we will use tolower. tolower(A) changes A to a. So even if we enter Y or N, it will be…
Q: #include <iostream> using namespace std; void additionProblem(int topNumber, int bottomNumber)…
A: Algorithm : 1. Start 2. Initialize the correct count variable to 0. 3. Initialize the count variable…
Q: #include int main() { int N; scanf("%d", &N); int input[N], ind, rem;…
A: The code can be explained as follows:The code starts by reading an integer N from the standard…
Q: need flowchart for this: #include #include char…
A: Below is the flowchart:
Q: How to fix this zeros?? Here's the code! #include struct student //Defining structure { int id;…
A: PROGRAM CODE AS PER GIVEN BY YOU: #include<stdio.h>struct student //Defining structure{int…
Q: let me enter the number of fork but only 1 character can be enter in the username. If I type…
A: Code is working perfectly in all scenarios. #include <stdio.h>#include…
Q: Every line of this c program please explain. Thank you Source Code: // include necessary…
A: //include hearder files for using C++ supported library//include cin, cout, etc libraries#include…
Q: #include using namespace std; int main() { string name,address,c_qual,c_spec,c_status; int…
A: As I go through the code I found you didn't check that entered value is an integer or not. so you…
Q: /*Author: Cody Guardipee Date: 5/1/2023 Purpose: Calculate Fuel Economy in Miles Per Gallon and…
A: C is a procedural and general-purpose programming language that can provide level access to system…
Q: OF A #include using namespace std int main) { char letter 'a RSITY while (letter != x) { cout >…
A: In the code, we have the initialized letter variable as an (alphabet) then on proceeding to while…
Q: Q: Find the results main () {int A, B;
A: I have provided answer of this question in step-2.
Q: int x = 0; int sum = 0; for (x = 5; x < 5; x = x + 1) { } cout << sum; What is the value of sum…
A: What is the value of sum printed? Ans - 0 Explanation - The initial value of x is 5 inside for…
Q: This program determines the minimum and maximum of three values inputby // the user and performs…
A: c++ program determines the minimum and maximum of three values input three int values output is…
Q: #include #include using namespace std; // declare functions void display_menu(); void…
A: Source Code : #include <iostream>#include <cmath>#include <cctype> // including…
Q: C++ Language Write two statements that each use malloc to allocate an int location for each…
A: Solution: We have to allocate int location for numPtr1 and numPtr2 like this- numPtr1 = (int*)…
Q: #include using namespace std; int main() { int a=10; int b=3; cout<<a%b; //predict output of this…
A: Given a=10, b=3. '%' operator gives the remainder when its left operand is divided by its right…
Q: // the calling statement is: cout (y)); else return(static_cast(2 * y) - x);
A: Correct option: 30
Q: C programming:you are to design and write a menu driven program as shown by the sample menu below.…
A: Given, C programming:you are to design and write a menu driven program as shown by the sample menu…
Q: C++ Programming: How can I get rid of the global variable "char gamePlayer = 'X';
A: The global variable x can be removed by creating a local instance of that variable and passing that…
Q: Write output of given code:
A: Integer variable num=14. Pointer to integer ptr which stores address of integer num.
Q: Create two more functions (options #3 and #4 in your menu) by taking the to_celsius() and…
A: C++ program for the above two problems :
Q: Task 2: Command-Line Arguments and String Copying #include #include int main(int argc, char*…
A: Let's go through each part of the task step by step:a. Execute the program with "012345678" as the…
Q: ow, modify it to do the following: Add two more functions to handle another type of…
A: Here we write simple function using function overloading:…
Q: The following function has errors. Locate as many errors as you can. void getValue(int value&) {…
A: GIVEN: The following function has errors. Locate as many errors as you can. void getValue(int…
Q: #include using namespace std; void swap(int a, int & b) B{ int temp = a; a = b; b = temp; 4 int…
A: The cout is a predefined object of ostream class.
Q: Write a statement that declares a pointer named 'qptr'. The pointer will be used to store the…
A: Write a statement that declares a pointer named aptr'. The pointer will be used to store the address…
Q: 5. How many the number of errors in the following sub_ program? #include void main( ) { intnum, sum…
A: Here in Error 1) intnum,sum=1; we should use space between int and num correct code int num,sum=1;…
Q: #include #include #include using namespace std; int main() { string userItem;…
A: Answer: #include <iostream>#include <sstream>//#include using namespace std; int main()…
Q: // Swap.cpp - This program determines the minimum and maximum of three values input by // the user…
A: Solution:: code: #include <iostream> using namespace std; int main() { // Declare…
Q: #include using namespace std; int main() { string c_name, address, c_spe, c_status; int…
A: #include <iostream>using namespace std;int main(){string c_name, address, c_spe, c_status;int…
Step by step
Solved in 3 steps with 1 images
- #include<stdio.h> #include<math.h> int main() { char cod; int gal; float cost; printf("Data Codes:"); printf(" \n H-Home \n C-Commercial \n I-Industrial "); printf("\nInput data code: "); scanf("%c", &cod); printf("\nInput number of water (in gallons) used: "); scanf("%d", &gal); if (cod=='H'|| cod=='h') { cost = 250+(0.002*gal); printf("\nTOTAL COST IS %.2f", cost); } else if (cod=='C'||cod=='c') { if (gal<=4000000) { printf("\nTOTAL COST IS 5000.00"); }…// SumAndProduct.cpp - This program computes sums and products // Input: Interactive// Output: Computed sum and product #include <iostream>#include <string>void sums(int);void products(int);using namespace std; int main() { int number; cout << "Enter a positive integer or 0 to quit: "; cin >> number; while(number != 0) { // Call sums function here // Call products function here cout << "Enter a positive integer or 0 to quit: "; cin >> number; } return 0;} // End of main function// Write sums function here// Write products function hereUntitled Section This is a segment of program, when it executed with multiple values for n and s the program displays the value of f, choose which output of f values are wrong answers cin>>x>>y; if (x>1) &&(y<5) {f=x+y*9; else f-x-y-11; } cout<#include <iostream> #include <cmath> using namespace std; // declare functions void display_menu(); void convert_temp(); double to_celsius(double fahrenheit); double to_fahrenheit(double celsius); int main() { cout << "Convert Temperatures\n\n"; display_menu(); char again = 'y'; while (again == 'y') { convert_temp(); cout << "Convert another temperature? (y/n): "; cin >> again; cout << endl; } cout << "Bye!\n"; } // define functions void display_menu() { cout << "MENU\n" << "1. Fahrenheit to Celsius\n" << "2. Celsius to Fahrenheit\n\n"; } void convert_temp() { int option; cout << "Enter a menu option: "; cin >> option; double f = 0.0; double c = 0.0; switch (option) { case 1: cout << "Enter degrees Fahrenheit: "; cin >> f; c =…#include <iostream>using namespace std; double average(int sum_of_grades,int num_grades){return sum_of_grades/(float)num_grades;} int main() {int num_grades,grade,sum=0;char grade_value;cout<<"Enter the number of grades"<<endl;cin>>num_grades;for(int i=0;i<num_grades;i++){cout<<"Enter a numeric grade between 0-100"<<endl;cin>>grade;sum+=grade;}double avg=average(sum,num_grades);if(avg>=90 && avg<=100)grade_value='A';else if(avg>=80 && avg<=89)grade_value='B';else if(avg>=70 && avg<=79)grade_value='C';else if(avg>=60 && avg<=69)grade_value='D';else if(avg>=0 && avg<=59)grade_value='F';cout<<"The grade is "<<grade_value;} review if the written c++ code is correct then organize the code and write comments for each part of the program explaining what they do.Finish the following code: void Divide (int dividend, int divisor, bool& error, float& result) // Set error to indicate if divisor is zero. // If no error, set result to dividend / divisor. { using namespace std; // For debugging cout << "Function Divide entered." << endl; cout << "Dividend = " << dividend << endl; cout << "Divisor = " << divisor << endl; //** // Rest of code goes here. //** // For debugging if (error) cout << "Error = true "; else cout << "Error = false "; cout << "and Result = " << result << endl; cout << "Function Divide terminated." << endl; }Program C Loop, pls help ASAP int getNum(); /*accepts input from the user.*/ void display(int num); /*prints the number pattern*/ ---------------------------------------------------------------------language = pythonThe program segment has errors. Find as many as you can. // This code should use a loop to raise a number to a power. int num, bigNum, power, count;cout << "Enter an integer: "; cin >> num; cout << "What power do you want it raised to? "; cin >> power; bigNum = num; while (count++ < power); bigNum *= num; cout << "The result is << bigNum << end1;#include<stdio.h> void main(){// variables to store input values for account balance and interest ratefloat balance, rate;// variables to store option and choice inputint option, choice;int i, j; // loop counters // outer loop to allows the user to repeat this calculation for a new balance and interest ratewhile(choice != 0){// asking and storing user inputprintf("Bank Account Balance: ");scanf("%f", &balance);printf("Interest Rate: ");scanf("%f", &rate); // printing mod menu and storing input for thatprintf("Mode Menu\n [1] Annually\n [2] Monthly\n");printf("Option: ");scanf("%d", &option); // if selected option is 1if(option == 1){// printing mode selectedprintf("Annually Interest\n");// for 5 yearsfor(i=1; i<=5; i++){// computing balance by adding interestbalance = balance + balance*rate/100.0;// printing balanceprintf("Bank Account Balance in Year %d: %.2f\n", i, balance);}}// if option 2 is selectedelse if(option == 2){// printing mode selectedprintf("Monthly…ê #include using namespace std; int main() { int count = 5; int num = 2; while (count r && num ){ cout << count << " " << num << endl; count -=1; if (count % 2 == 0) num -=1; } return 0; Output: 52 4 1 3 1 20 10// 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; }SEE MORE QUESTIONS