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
#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;
}
Comments
Leave a comment