1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Varvara68 [4.7K]
3 years ago
11

Type the statements below, correcting the one syntax error in each statement.

Computers and Technology
1 answer:
jasenka [17]3 years ago
3 0

Answer:

Corrected statements:

cout<<"Foretelling is hard."<<endl;

cout << "Particularly";

cout << "of the future." << endl;

cout << "User num is: " << userNum << endl;

Explanation:

  • Statement 1:  cout << "Foretelling is hard." <<end;

Syntax Error generated when the statement is compiled:  no match for ‘operator<<’ (operand types are ‘std::basic_ostream’ and ‘’)

This error is generated because "end" is used which is not valid. It should be replaced with endl which is used to insert a new line.

So the corrected statement without syntax error is:  

cout << "Foretelling is hard." <<endl;

The output of this corrected line is as following:

Foretelling is hard.

  • Statement 2: cout << "Particularly ';

Syntax Error generated when the statement is compiled: missing terminating " character

This error is generated because the one of the double quotations is missing  in the statement and single quote is used instead which resulted in syntax error. So in order to correct this syntax error single quote ' should be replaced with double quotation mark ".

So the corrected statement without syntax error is:  

   cout << "Particularly";

The output of this corrected line is as following:

Particularly

  • Statement 3: cout << "of the future." << endl.

Syntax Error generated when the statement is compiled:

‘std::endl’ does not have class type

This error is produced because the statement did not end in semicolon. Instead it is ended with a period (.) placed after endl

So in order to remove this syntax error ; is placed instead of .

So the corrected statement without syntax error is:  

cout << "of the future." << endl;

The output of this corrected line is as following:

of the future

  • Statement 4: "User num is: " << userNum >> endl;

Syntax Error generated when the statement is compiled:

no match for ‘operator>>’ (operand types are ‘std::basic_ostream’ and ‘’)

This error is produced because extraction operator >> is being used instead of insertion operator << . Here the value of userNum is to be displayed and next line is to be inserted so insertion operator << should be used in place of extraction operator which is used for input.

So the corrected statement without syntax error is:  

cout << "User num is: " << userNum << endl;

Now lets declare the variable userNum and assign it value 5 as:

int userNum = 5;

So output of this corrected line is as following:

User num is: 5

If tested for userNum=11 then the output is as following:

User num is: 11

You might be interested in
Which of the following is true of the 529 plan
sesenic [268]

A 529 Plan is an education savings plan operated by a state or educational institution designed to help families set aside funds for future college costs.

your answer will be: It is a tax-advantaged college savings plan.

5 0
3 years ago
Read 2 more answers
Gabe wants to move text from one document to another document. He should _____.
Lorico [155]
Copy and paste the text
8 0
3 years ago
Read 2 more answers
When working in Photoshop with the move tool, you can select multiple layers and use this option to arrange them into a straight
wel

Answer:

Distribute -  will put all of the layers in a straight line across the image

6 0
4 years ago
Read 2 more answers
Name the different views in word​
svlad2 [7]

Answer:

Print Layout, Full-Screen Reading, Web Layout, Outline, and Draft are 5 different views in Word.

Hope this helps!

4 0
3 years ago
Question 8 of 25
denis23 [38]

Answer:

D to Protect sensitive data, Enterprise has certain security features and is mostly used in business settings.

5 0
2 years ago
Other questions:
  • Encrypt the message ENCRYPTION using a tabular transposition cipher with encryption keyword ONE. If necessary, pad the message w
    7·1 answer
  • Pretrial services programs are also known as early intervention programs. <br> a. True <br> b. False
    15·1 answer
  • You have to calculate the total amount you spent at the mall today. Which function should you use to do so?
    6·2 answers
  • Who created apple and in what year was it created
    9·2 answers
  • Demographics refers to
    7·1 answer
  • A subroutine may be used to refer to which of the following? Check all that apply.
    15·2 answers
  • Leah wants to add an image to her updated presentation, so she wants to access the Help interface. What should Leah do to access
    11·2 answers
  • Which type of evaluation requires that the program be fully implemented before the evaluation can begin
    9·1 answer
  • What statement describes the last step in evaluating<br> information?
    10·1 answer
  • Which quality should an experiment have to be replicable and valid? O clearly detailed results O a well-cited research paper O s
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!