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
What is a many-to many types of correspondence?
Ann [662]

Answer:

We have many types of correspondences. There are internal correspondences, external correspondences, sales correspondences, and personalized correspondences. By many to many correspondences we mean, a lot of people correspond with a lot many people from another department, company or market, or any set of people in fact. An internal correspondences, sales correspondences, personalized correspondences or external correspondences can be of many to many types, and as well as of others like one to one, many to one and so on.

Explanation:

Please check the answer.

5 0
3 years ago
Programmers refer to a sequence of characters as a ____.
jekas [21]
In programming they know it as a String which is  a sequence of characters that are composed of literal constants or some kind of variables. A sting is any finite sequence of characters. every single string has its own lenght and this is one of the most important characteristics of them. Strings are essential to communicate information from the program to the user. 
5 0
3 years ago
Whats a field in databases?
SVETLANKA909090 [29]
A field is a single attribute of an entity, object or event.
3 0
3 years ago
Why should electronics be allowed in school
dedylja [7]

Answer:

It can help kids with stimulation and it can also help them learn more. also in case of an emergency, kids will be able to reach the authorities easier

6 0
3 years ago
Which expression adds 1 to the element of array arrayname at index i?
NemiM [27]
I believe the answer is <span>++arrayName[ i ].

</span>
8 0
3 years ago
Other questions:
  • ................njkkjjiooiuuuu
    6·1 answer
  • why is this message poor or ineffective ,Due to low profits,there will be no annual year-end bonus this year. We hope to have a
    13·2 answers
  • You can use the Ignore All button to ignore the current and all future occurrences of a flagged word. True or False
    5·1 answer
  • When an attacker promotes themselves as reputable third-party advertisers to distribute their malware through the Web ads,
    15·1 answer
  • Which button should be utilized if a user is unsure whether or not they are the right person to reply to an email?
    6·2 answers
  • Write a program that asks the user to enter a series of numbers separated by commas. Here is an example of valid input: 7,9,10,2
    6·1 answer
  • When light does not pass through or bounce off an object, it is said to be
    13·2 answers
  • The _____ feature will mark all changes made to a document for others to review at a later time.
    13·1 answer
  • A specific type of computer program that manages the other programs on a computer
    6·1 answer
  • It is a kind of malware (malicious software) that criminals install on your computer so they can lock it from a remote location.
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!