Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ * Exercises: 1 . Complete the program below. Sample Run: Hello from main! Hello from the writeMessage function! Write a custom message: Hello! Hello!

/* Exercises:
1. Complete the program below.
Sample Run:
Hello from main!
Hello from the writeMessage function!
Write a custom message: Hello!
Hello!
Back in main!
*/
// This program prints a message by calling a function.
#include // Required for cin and cout
#include // Required for string
using namespace std; // Required for not having to use std::
// Write a message to the console from a function
void writeMessage();
void writeCustomMessage(string message);
// The main function
int main(){
cout << "Hello from main!" << endl;
// TODO: Call the writeMessage function
string customMessage;
cout << "Write a custom message: ";
cin >> customMessage;
// TODO: Call the writeCustomMessage function with the customMessage as a parameter
cout << "Back in main!" << endl;
return 0;
}
// The function to write a message
void writeMessage(){
cout << "Hello from the writeMessage function!" << endl;
}
// The function to write a custom message
void writeCustomMessage(string message){
cout << message << endl;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago