NOTE: This is what I've guessed for the function prototypes, if you've more information and want to change the code, do let me know In the comments section below.
Code:
#include <iostream>
#include <string>
using namespace std;
// function prototypes
// 1.) this function wil display a menu, so it return type would
be void
// also it may not need any input arguments
void showMenu();
// 2.) this function gets user choice, as choice is declared as
char in main
// it's return type would be char, again it doesn't need any
arguments
char getChoice();
// 3.) this function calculates result, and result is declared
as double in main
// so it's return type would be double, also there are two numbers
declared in main
// num1 and num2 so calcResult() may perform some calculation on
these
// numbers so they'll be our input arguments
double calcResult(double num1, double num2);
// 4.) this function will show the result, it requires result as
input argument to show
// it and need not have a return type
void showResult(double result);
// 5.) as there are two strings in main() describing firstName
and lastName
// may be this function is used to get this info (i.e name), but as
a function can
// only return one value these strings would be passed as based on
reference
// so the return type will be void and input arguments will be
addresses to the string
void getInfo(string &firstName, string &lastName);
// 6.) this will show the name so it's input arguments will be
first and last name, and
// return type will be void
void showName(string firstName, string lastName);
// 7.) as this function's name suggest it'll be used to
calculate square of a number, so
// input argument will be the number and return type it's
square
double calcSquare(double number);
// 8.) again this function is used to check whether a number is
positive or not, so input
// will be the number to check and return type will be a boolean
for yes or no
bool isPositive(double number);
int main()
{
double num1 = 1.5;
double num2 = 2.5;
char choice;
double result;
string firstName;
string lastName;
char initial;
bool isPos;
return 0;
}
OUTPUT:
Output to show that the program has successfully compiled.
need help on this! Just write the function prototype for the following finctions while also using...
Need help with this C++ homework I need help problem 1-9 that possible if my wish? Thank you friend Tiet WRITE FUNCTION PROTOTYPES for the following functions. The functions are described below on page 2. (Just write the prototypes) When necessary, use the variables declared below in maino. mm 1.) showMenu m2.) getChoice 3.) calcResult m.) showResult 5.) getInfo mm.) showName 7.) calcSquare 8.) ispositive int main { USE THESE VARIABLES, when needed, to write function prototypes (#1 - #8)...
Need help problem 9-13 C++ Homework please help WRITE FUNCTION PROTOTYPES for the following functions. The functions are described below on page 2. (Just write the prototypes) When necessary, use the variables declared below in maino. mm 1.) showMenu m2.) getChoice 3.) calcResult m.) showResult 5.) getInfo mm.) showName 7.) calcSquare 8.) ispositive int main { USE THESE VARIABLES, when needed, to write function prototypes (#1 - #8) double num1 = 1.5; double num2 = 2.5; char choice; double result;...
answer in c++ Using the table below, complete the C++ code to write the function prototype statement, and the void function header. The void function should receive three double variables: the first two by value and the last one by reference. Name the formal parameters num1, num2 and answer. The function should divide the num1 variable by the num2 variable and then store the result in the answer variable. Name the function calcQuotient. Also write an appropriate function prototype for...
Fix this code so only the function prototype comes before main. #include <iostream> using namespace std; bool isMultiple(int num1, int num2) { return num1 % num2 == 0; } int main() { char ch = 'Y'; int num1, num2; while(ch =='Y') // While ch is equal to Y { cout << "Enter two numbers(largest first): "; cin >> num1; // Getting 1st number cin >> num2; // Getting 2nd number if(isMultiple(num1, num2)) cout << num2 << " " << "IS...
i need help fixing my code. here is the assignment: Make a class that contains the following functions: isLong, isDouble, stringToLong, and stringToDouble. Each receives a string and returns the appropriate type (bool, bool, long, and double).During the rest of the semester you will paste this class into your programs and will no longer use any of the "standard" c# functions to convert strings to numbers. here is my code. it works for the long method but not the double:...
Pointer arithmetic: a) Write a printString function that prints a string (char-by-char) using pointer arithmetics and dereferencing. b) Write a function “void computeMinMax(double arr[], int length, double * min, double * max)” that finds the minimum and the maximum values in an array and stores the result in min and max. You are only allowed to use a single for loop in the function (no while loops). Find both the min and the max using the same for loop. Remember...
Run the C program below and complete the table showing all the variables. Add printf function calls to obtain the addresses and values of all 13 variables. (Count the array (ca) as 3 variable/values and also include argc and argv in the table). The table must show the Address, Name, Datatype, Scope, and Value of each variable on the stack. (Hint: use the sizeof function to double check your addresses.) Explain how different the actual memory allocations are from what...
2. Pointer arithmetic: a) Write a printString function that prints a string (char-by-char) using pointer arithmetics and dereferencing. b) Write a function “void computeMinMax(double arr[], int length, double * min, double * max)” that finds the minimum and the maximum values in an array and stores the result in min and max. You are only allowed to use a single for loop in the function (no while loops). Find both the min and the max using the same for loop....
Here is the code from the previous three steps: #include <iostream> using namespace std; class Student { private: //class variables int ID; string firstName,lastName; public: Student(int ID,string firstName,string lastName) //constructor { this->ID=ID; this->firstName=firstName; this->lastName=lastName; } int getID() //getter method { return ID; } virtual string getType() = 0; //pure virtual function virtual void printInfo() //virtual function to print basic details of a student { cout << "Student type: " << getType() << endl; cout << "Student ID: " << ID...
you need to write a C function named rem. The prototype is: int rem(char*, char*); The function accepts 2 strings: the first is a string of text to process; the second is where the output will be placed. rem() should remove all occurrences of a lowercase 'x' from the first string, and save the resulting string in the second arg. You may use the strlen() function; no other built-in fuctions should be used. Test your program thoroughly. Then, once you...