Question

c++ 1) Write a header file that contains the prototype for a function that takes two...

c++

1) Write a header file that contains the prototype for a function that takes two value parameters (both floats) and returns a single character output. The function name is “charIn”. We do not care what the function does at this point. (8)

2)   Fix the Errors of the C++ program:
a.   #include <cmath>
b.   Void main(){cout<< “Math test”<<endl;//start math test
c.   Int i=10 int j=3 k=i%3 cout << “test of mod<<k<<endl
d.   Float d=0 float f=e/d cout << “div test<<f<<endl;
e.   }}

0 0
Add a comment Improve this question Transcribed image text
Answer #1
//functions.h
#ifndef FUNCTIONS_H_INCLUDED
#define FUNCTIONS_H_INCLUDED

char charIn(float a, float b);

#endif

=====================================
#include <iostream>
#include <cmath>

using namespace std;

int main(){
   cout<< "Math test"<<endl;//start math test
   int i=10;
   int j=3;
   int k=i%3;
   cout << "test of mod "<<k<<endl;
   float f=i/j; 
   cout << "div test "<<f<<endl;
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
c++ 1) Write a header file that contains the prototype for a function that takes two...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • How to turn this file into a main.cpp, a header which contains the function declaration, and...

    How to turn this file into a main.cpp, a header which contains the function declaration, and a implementation fiel containing the function definition ? #include<iostream> #include<string> #include<iomanip> using namespace std; #define NUM 1 #define MULT 4 void getPi(int iter); int main() {    int it;    cout << "Enter the number of iterations needed to find PI: ";    cin >> it;    while (it < 1) {        cout << "Error!!! Iteration input should be positive." << endl;...

  • answer in c++ Using the table below, complete the C++ code to write the function prototype...

    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...

  • anyone help me seperate this into a header file (.h contains function and variable delcaration) and...

    anyone help me seperate this into a header file (.h contains function and variable delcaration) and a implementation file (.cpp that contains the definitions for the functions and variables) #include <iostream> using namespace std; #define MAXSIZE 100 class Grader{ private: int my_Values[MAXSIZE]; int my_valuesSeenSoFar; public: Grader(){ my_valuesSeenSoFar = 0; } void addScore(int score){ my_Values[my_valuesSeenSoFar++] = score; } void addScores(int scores[], int size){ for(int i = 0; i < size; i++){ my_Values[my_valuesSeenSoFar++] = scores[i]; } } void clear(){ for(int i =...

  • Consider the function prototype below. Write the missing function call. float Rent(float , int &); int...

    Consider the function prototype below. Write the missing function call. float Rent(float , int &); int main() { int d; // Days in hotel. float r=149.55; // Daily Rate (r). float cost; // Total cost of stay of d days. cout << "Daily room rate = $" << r << endl; cout << "#Days you will be staying: "; cin >> d; ______________________________________________ // MISSING statement. cout << "The cost of your stay of " << d << " days...

  • 1. A(n) ____________________ is a variable or expression listed in a call to a function. 2....

    1. A(n) ____________________ is a variable or expression listed in a call to a function. 2. The pass by ____________________ mechanism must be used if the calling code is to receive information back from the function. 3. True or False? If there are several items in a parameter list, the compiler matches the parameters and arguments by their relative positions in the parameter and argument lists. 4. True or False? In C++, a function definition may have another function definition...

  • 81. The following function call doesn’t agree with its prototype:              cout << BoxVolume( 10, 5...

    81. The following function call doesn’t agree with its prototype:              cout << BoxVolume( 10, 5 );                    int BoxVolume(int length = {1}, int width = {1}, int height = {1});                                                     T__   F__                                                                     82. The following function is implemented to swap in memory the          argument-values passed to it:         void swap(int a, int b)                   {           int temp;             temp = a;             a = b;             b = temp;        ...

  • C++ Questions. Question 1 What would the function prototype in the class declaration for the following...

    C++ Questions. Question 1 What would the function prototype in the class declaration for the following member function look like? void Fractions::showData() { if((num < 0 && denom < 0) || denom < 0) { num = -num; denom = -denom; } cout << num << "/" << denom << endl; } Question 2 What would the function header of the following member function prototype in class Fractions be? Fractions operator+(const Fractions &f2); Question 3 What would the function prototype...

  • C++, Change the destroy_list function in the header file to a recursive destroy_list function, main is...

    C++, Change the destroy_list function in the header file to a recursive destroy_list function, main is already set. Hint: It might be helpful to modify the function so that it uses a separate recursive function to perform whatever processing is needed. //////////////////////////////////////////////////////////////header.h////////////////////////////////////////////////////////////////////////////////////////////// #ifndef HEADER_H_ #define HEADER_H_ #include using namespace std; template <class T> class LL { private:    struct LLnode    {        LLnode* fwdPtr;        T theData;    };    LLnode* head; public:    LL();    void...

  • Write a C++ Program. You have a following class as a header file (dayType.h) and main()....

    Write a C++ Program. You have a following class as a header file (dayType.h) and main(). #ifndef H_dayType #define H_dayType #include <string> using namespace std; class dayType { public:     static string weekDays[7];     void print() const;     string nextDay() const;     string prevDay() const;     void addDay(int nDays);     void setDay(string d);     string getDay() const;     dayType();     dayType(string d); private:     string weekDay; }; #endif /* // Name: Your Name // ID: Your ID */ #include <iostream>...

  • C++ programming I need at least three test cases for the program and at least one...

    C++ programming I need at least three test cases for the program and at least one test has to pass #include <iostream> #include <string> #include <cmath> #include <iomanip> using namespace std; void temperatureCoverter(float cel){ float f = ((cel*9.0)/5.0)+32; cout <<cel<<"C is equivalent to "<<round(f)<<"F"<<endl; } void distanceConverter(float km){ float miles = km * 0.6; cout<<km<<" km is equivalent to "<<fixed<<setprecision(2)<<miles<<" miles"<<endl; } void weightConverter(float kg){ float pounds=kg*2.2; cout<<kg<<" kg is equivalent to "<<fixed<<setprecision(1)<<pounds<<" pounds"<<endl; } int main() { string country;...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT