1) Predefined and Value Functions Program - Write a program that contains four value functions. One function should input an integer and return the absolute value of the integer. The second function...

1 answer below »

1)Predefined and Value Functions Program- Write a program that contains four value functions.



  • One function should input an integer and return the absolute value of the integer.

  • The second function should input a double and return the absolute value of the double.

  • The third function should input a letter and return the upper case version of the letter.

  • The fourth function should input a letter and return the lower case version of the letter.


The main function should call all four functions and should display the values returned with appropriate labels.




Code from Class - 10/27/2020Code from Class - 10/27/2020 /* October 27, 2020 Intro to Functions */ #include #include #include using namespace std; //Function prototypes //void display_message(); //void display_message(string); void display_message(string, string); int main() { string err_message = "** INVALID DATA **"; display_message("Hello World", err_message); /* Using standard library functions double num, results; cout < "enter="" an="" interger:="" ";="" cin="">> num; results = sqrt(num); cout < "the="" square="" root="" is:="" "="">< sqrt(num)="">< endl;="" return="" 0;="" */="" }="" *void="" -="" display_message="====================================" void="" display_message()="" {="" local="" variables="" string="" message="Hello World!" ;="" cout="">< message="">< endl;="" }="" void="" -="" display_message="" with="" one="" parameter="====================================" void="" display_message(string="" message)="" {="" local="" variables="" cout="">< message="">< endl;="" }="" */="" void="" -="" display_message="" with="" two="" parameter="====================================" void="" display_message(string="" message1,="" string="" message2)="" {="" local="" variables="" cout="">< message1="">< endl;="" cout="">< message2="">< endl; } endl;="">
Answered Same DayNov 02, 2021

Answer To: 1) Predefined and Value Functions Program - Write a program that contains four value functions. One...

Neha answered on Nov 10 2021
130 Votes
/******************************************************************************
O
nline C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include
#include
#include
#include
#include
using namespace std;
const double MIN_GRADE = 0.0, MAX_GRADE = 100.00;
const int NUM_GRADES = 4;
const string SENTINEL = "XX";
string input_filename();
double get_grade(int count);
double get_average();
void display_file(const string filename);
bool input_names(string& f_name , string& l_name);
bool create_file(string& file_name);
int main()
{
string file_name;
file_name = input_filename();
create_file(file_name);
display_file(file_name);
return 0;
}
string input_filename()
{
string file_name;
// Get file name
cout << "\nEnter file name: ";
getline(cin, file_name);
return file_name;
}
double...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here