it is for c++ on linux operating system this next cooding is [[[[[ \"existing_fu
ID: 670047 • Letter: I
Question
it is for c++ on linux operating system
this next cooding is [[[[[ "existing_functions.h"]]]]]
[[[[[
#include <iostream>
#include "cmps222lib.h"
using namespace std;
/*
param1: text to display to console
param2: minimum acceptable value
param3: maximum acceptable value
return: value from console
*/
int PromptForIntInRange(string,int,int);
/*
param1: value to compare a
param2: value to compare b
return: is a<b
*/
bool IsLower ( int, int );
/*
param1: value to compare a
param2: value to compare b
return: is a>b
*/
bool IsHigher ( int, int );
/*
param1: value to compare a
param2: value to compare b
return: is a==b
*/
bool IsEqual ( int, int );
/*
param1: minimum acceptable value
param2: maximum acceptable value
return: random number in range
*/
int CreateRandom(int, int);
/* next 3 functions push messages to the console */
void PrintTooHigh();
void PrintTooLow();
void PrintMatch();
]]]]]
{{{{
#include "existing_functions.h"
/*
make the guessing game
dont use
<,>,<=,>=,==, cout , cin, rand
use the functions in "existing_functions.h"
*/
int main()
{
return 0;
}
Explanation / Answer
This is your main.cpp
#include "existing_functions.h"
/*
make the guessing game
dont use
<,>,<=,>=,==, cout , cin, rand
use the functions in "existing_functions.h"
*/
int main()
{
int min = 9, max = 89;
int num = CreateRandom(min, max);
while (true){
int guess = PromptForIntInRange("Guess a number(9 to 89)", min, max);
if (IsLower(guess, num)){
PrintTooLow();
}
else if (IsHigher(guess, num)){
PrintTooHigh();
}
else if (IsEqual(guess, num)){
PrintMatch();
break;
}
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.