Answer to Question #321307 in C++ for nickname

Question #321307

Write a program with three functions that all use the same global constant. The global constant is the name of a video game: "Fun With Math 2". Each of the functions should output a message that contains this global constant. There is one intro message, one game-exit message, and one game completion message. 

 

Output:

Welcome to Fun With Math 2

This program aims to improve your math skills via interactive games.

 

Thank you for playing Fun With Math 2

Remember to practice daily!

 

You have successfully completed all of the activities in Fun With Math 2

Be sure to look out for the 3rd edition of this game (Coming in Summer 2049)!


1
Expert's answer
2022-05-03T14:19:24-0400
#include <iostream>
#include <string>
using namespace std;


//Global variable declaration
string name_game = "Fun With Math 2";


void intro(){
	cout << "Welcome to " << name_game << endl;
	cout << "This program aims to improve your math skills via interactive games." << endl;
}


void game_exit(){
	cout << "Thank you for playing " << name_game << endl;
	cout << "Remember to practice daily!" << endl;
}


void completion(){
	cout << "You have successfully completed all of the activities in " << name_game << endl;
	cout << "Be sure to look out for the 3rd edition of this game (Coming in Summer 2049)!" << endl;
	
}


int main(){
	intro();
	cout << endl;
	game_exit();
	cout << endl;
	completion();
	return 0;
}

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