Question

In the following statements you may find some errors.  Line number are included to the left of...

In the following statements you may find some errors.  Line number are included to the left of each line to help with your answers. Hint: number of points equals at least the number of errors.

1: */ what’s wrong with this program? /*

2: #include iostream

3: using namespace std;

4: int main();

5: }

6: int x,y,z \\ Three integers

7: x=24

8: y=84;

9: z=x+y,

10: Cout<"The value of z is "<Z;

11: Return;

12: {

Homework Answers

Answer #1

Error1 -Line 2 - #include iostream -> correct version is - #include<iostream>

Error2 - Line 5 - } -> correct version is - {

Error3 - Line 6 - int x,y,z -> correct version is - int x,y,z;

Error4 -Line 7 - int x= 24 - > correct version is - int x = 24;

Error5 - Line 9 - z=x+y, -> correct version is - z=x+y;

Error6,7 and 8(three errors, one is with the Cout and other is with the Z is in uppercase and cout<< is the correct syntax)- Line 10 -  Cout<"The value of z is "<Z; -> correct version is -> cout<<"the value of z is "<<z;

Error 9: Return; -> correct version is -> return;

Error10: Line 12 -> { -> correct version is -> }

Hope I answered the question, if you have any doubts, feel free to ask

And if you like my answer then please upvote.

Thank you!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Arrange the following lines into a working program, correct any errors you find in identifier names...
Arrange the following lines into a working program, correct any errors you find in identifier names and/or incorrect program structure : 4str4 = “Programming in ”; using namespace std; str1 = "CSC" cout << str6 << endl; int main() ; { str2 = "201"; str3 = Second Semester CS; #include<iostream>   string str1, str2, str3, str4, str5, str6; return 0; str6 = str4 + str5 + " " + str1 + " " + str2 + " " + str3; str5...
Rewrite the following program using switch statements. //Set 7.1 #include <iostream> #include <iomanip> using namespace std;...
Rewrite the following program using switch statements. //Set 7.1 #include <iostream> #include <iomanip> using namespace std; int main() {        int x;        cout << "Selection option " << endl;        cin >> x;        if (x == 1)               cout << "You select option 1" << endl;        else if (x >= 2 || x <= 4)               cout << "You select options 2 or 3 or 4" << endl;               else if (x == 10)               cout << "You select option 10" << endl;               else...
C++ Please and thank you. I will upvote Read the following problem, and answer questions. #include<iostream>...
C++ Please and thank you. I will upvote Read the following problem, and answer questions. #include<iostream> using namespace std; void shownumbers(int, int); int main() { int x, y; cout << "Enter first number : "; cin >> x; cout << "Enter second number : "; cin >> y; shownumbers(x, y); return 0; } void shownumbers(int a, int b) { bool flag; for (int i = a + 1; i <= b; i++) { flag = false; for (int j =...
C++ please Write code to implement the Karatsuba multiplication algorithm in the file linked in Assignment...
C++ please Write code to implement the Karatsuba multiplication algorithm in the file linked in Assignment 2 (karatsuba.cpp) in Canvas (please do not rename file or use cout/cin statements in your solution). As a reminder, the algorithm uses recursion to produce the results, so make sure you implement it as a recursive function. Please develop your code in small The test program (karatsuba_test.cpp) is also given. PLEASE DO NOT MODIFY THE TEST FILE. KARATSUBA.CPP /* Karatsuba multiplication */ #include <iostream>...
Explain each line in main (you can put it in the comments) and explain why the...
Explain each line in main (you can put it in the comments) and explain why the output looks how it looks. #include <iostream> using namespace std; class A { public:        A()        {               n=0;        }        A(int x)        {               n=x;        }        void f()        {               n++;        }        void g()        {               f();               n=n*2;               f();        }        int k()        {               return n;        }       ...
C++ PROGRAMMING Hi! I have to make a program that adds fractions and simplifies them. I...
C++ PROGRAMMING Hi! I have to make a program that adds fractions and simplifies them. I feel like I know how to write that. What I'm having trouble with is implementing two files the professer gave us. I would appreicate any help in understanding their purpose as in if Im supposed to take information from those files or give it information. Thank you! I have attatched the homework instructions and the two files given. Implementation The main program, called calculator.cpp...
Experience with Functions Are the following statements a function header, a prototype or a function call?...
Experience with Functions Are the following statements a function header, a prototype or a function call? double calcMonthlyPmt(double amt); void displayResults() void showMenu(); showNum(45.67); area = CalArea(5,10); Write the function calls for the following headers and prototypes: void showValue(int quantity) void display(int arg1, double arg2, char arg3); pass the following to the call: int age; double income; char initial double calPay(int hours, double rate); What is the output of the following program? #include <iostream> using namespace std; void showDouble(int); //Function...
in C++ Please and thanks Here is a list of 6 numbers. Use the selection sort...
in C++ Please and thanks Here is a list of 6 numbers. Use the selection sort algorithm to sort this list. Fill in this table with each iteration of the loop in the selection sort algorithm. Mark the place from which you are looking for the 'next smallest element'. In this display, the upper numbers are the indices, the lower numbers are in the corresponding positions. Use the several rows provided to show the sequence of steps. 0 1 2...
Write a C++ Program Consider the following incomplete C++ program: #include <iostream> using namespace std; int...
Write a C++ Program Consider the following incomplete C++ program: #include <iostream> using namespace std; int main() {    …. } Rewrite the program include the following statements. Include the header file fstream, string, and iomanip in this program. Declare inFile to be an ifstream variable and outFile to be an ofstream variable. The program will read data from the file inData.txt and write output to the file outData.txt. Include statements to open both of these files, associate inFile with...
BASIC c++ question Please do not try to fix this, I just have a question regarding...
BASIC c++ question Please do not try to fix this, I just have a question regarding the function of this code. I understand this is an infinite loop, however, why is it that when I enter '0', it continues to ask the user for an input, but when I enter a letter, it continues infinitiy. And when it does infinitely loop, why is it that it continues to add 1 to each number? Doesn't the loop go through each line...