What's the output from this program using fork() and why?

Whats wrong with my Class in C++?

  • Im trying to use everything ive learned so far into a conversion program, meaning im trying to use: classes, functions, return, user input, and over all a working program. But im coming across an error and im fairly new to C++, so some guidance would be most appreciated: // TempClass - going to creat my first class independannlt and use everything ive // learned thus far to create my own programs // borrowing from Conversion.cpp #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; class TempClass { public: int ConversionFunct() { // enter the temperature in Celsius int celsius; cout << "Enter the temperature in Celsius:"; cin >> celsius; // calculate conversion factor for Celsius // to Fahrenheit int factor; factor = 212 - 32; // use conversion factor for Celsius // into Fahrenheit int fahrenheit; fahrenheit = factor * celsius/100 + 32; // output the results (followed by a NewLine) cout << "Fahrenheit value is:"; cout << fahrenheit << endl; } }; int main(int nNumberofArgs, char* pszArgs[]) { // call the function ConversionFunct in the class TempClass TempClass convObject; convObject.ConversionFunct; // wait until user is ready before terminating program // to allow the user to see the program results system("PAUSE"); return 0; } The errors are: 32: No return stated statement cannot resolve address of overloaded function Please some help ^ ^ thank you

  • Answer:

    2 problems: 1. Your ConversionFunct() function is supposed to return an integer, but doesn't have any return statements. Either add a return statement, or change its type to void. 2. When you invoke the ConversionFunct() function on convObject, you need to include the parentheses, even if you have no arguments, like: convObject.ConversionFunct(); (that's also not exactly the formula for converting Celcius to Fahrenheit, but that's not really a coding issue)

Kira L. at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

You have defined the function int ConversionFunct(). But you are not returning an integer from that function. You should either define the function as void ConversionFunct() Or you should return some integer value from it.

Kiran

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.