Answer to Question #315519 in C++ for nickname

Question #315519

Create two functions (with appropriate names) that produce the output below. Both functions must use a prototype. All that should be present in main() is the call to these two functions and a blank line of output between the function calls. 

 

This is a very easy exercise. Focus on the fundamentals. Make sure you review my solution file to make sure your syntax and name choice is good.

 

Output:

 

This is the first part of my program.

It was created with a function.        <-- These two lines are output by the first function

 

This is the second part of my program.

It was created with a different function.     <-- These two lines are output by the second function


1
Expert's answer
2022-03-22T03:58:37-0400
#include <iostream>
#include <string>
using namespace std;


void first_part(string str);
void second_part(string str);


int main() {
    first_part("It was created with a function.");
    cout << endl;
    second_part("It was created with a different function.");


    return 0;
}


void first_part(string str) {
    cout << "This is the first part of my program." << endl;
    cout << str << endl;
}


void second_part(string str) {
    cout << "This is the second part of my program." << endl;
    cout << str << endl;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog