SHARE
SPREAD
HELP

The Tradition of Sharing

Help your friends and juniors by posting answers to the questions that you know. Also post questions that are not available.


To start with, Sr2Jr’s first step is to reduce the expenses related to education. To achieve this goal Sr2Jr organized the textbook’s question and answers. Sr2Jr is community based and need your support to fill the question and answers. The question and answers posted will be available free of cost to all.

 

#
Authors:
Walter Savitch ,julia Lobur
Chapter:
Procedural Abstraction And Functions That Return A Value
Exercise:
Self-test Exercises
Question:4 | ISBN:9780321531346 | Edition: 7

Question

4. Write and compile short programs to test the following issues:

a. Determine whether your compiler will allow the #include <iostream>

anywhere on the line, or if the # needs to be flush with the left margin.

b. Determine whether your compiler will allow space between the # and

the include.

TextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbookTextbook

Answer

a.

//To determine whether the compiler will tolerate

 

//spaces before the # in the #include:


#include <iostream>
int main( )
{
    cout << "hello world" << endl;
    return 0;
}

 

b.

//To determine if the compiler will allow spaces

 

//between the # and include in the #include:

 

# include<iostream>

 

using namespace std;

 

//The rest of the program can be identical to the above.

0 0

Discussions

Post the discussion to improve the above solution.