182,212 views
17 votes
17 votes
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

User Tom Ellis
by
2.3k points

1 Answer

22 votes
22 votes

Answer:

In C++:

#include <iostream>

using namespace std;

void function1(); void function2();

int main(){

function1(); function2();

return 0;}

void function1(){

cout<<"This is the first part of my program."<<endl<<"It was created with a function"<<endl;}

void function2(){

cout<<"This is the second part of my program."<<endl<<"It was created with a different function.";}

Step-by-step explanation:

This defines the function prototypes

void function1(); void function2();

The main begins here

int main(){

This calls the two functions from main

function1(); function2();

return 0;}

This calls function1()

void function1(){

cout<<"This is the first part of my program."<<endl<<"It was created with a function"<<endl;}

This calls function2()

void function2(){

cout<<"This is the second part of my program."<<endl<<"It was created with a different function.";}

User Pakka Pakka
by
2.6k points