Ask your own question, for FREE!
Mathematics 13 Online
OpenStudy (bahrom7893):

ALCHEMISTA I NEED YOUR HELP!!! go to a new thread please!

OpenStudy (bahrom7893):

okay here..

OpenStudy (bahrom7893):

remember how yesterday we were doing the char choice stuff.. so right now I'm trying to add an option within an option basically..

OpenStudy (bahrom7893):

so first it asks for: 1) Available converters 2) Problem solvers then depending on what i pick it takes me to converters, where i get to pick again

OpenStudy (bahrom7893):

but i keep getting errors.. wait here's the code it's not finished yet though..

OpenStudy (bahrom7893):

here

OpenStudy (bahrom7893):

did u notice anything yet?

OpenStudy (anonymous):

one second.

OpenStudy (anonymous):

Main is missing an opening brace.

OpenStudy (bahrom7893):

ohhh that's why thanks.. there's probably more stupid mistakes.. there

OpenStudy (anonymous):

you have a strange switch statement before the menu display.

OpenStudy (anonymous):

ah I see one second.

OpenStudy (anonymous):

the problem is its grown considerably and you should really start splitting the program int separate routines but ill fix the problems for now

OpenStudy (bahrom7893):

oh i see is there any neat way to split it up?

OpenStudy (bahrom7893):

I mean i know what i'm supposed to do but there's just too much and it's like u have to pay attention..

OpenStudy (anonymous):

// SolverandConverter.cpp : Defines the entry point for the console application. // #include <iostream> using namespace std; int converters () { char choice; float value; cout << "Available converters:" << endl << "1) Kilometers -> Meters" << endl << "2) Meters -> Kilometers" << endl << "3) Feet -> Meters" << endl << "4) Meters -> Feet" << endl << "5) Farenheit -> Celsius" << endl << "6) Leave menu" << endl; for ( ;; ) { cout << "Select: " << flush; cin >> choice; switch ( choice ) { case '1': cout << "Kilometers=" << flush; cin >> value; cout << value << " kilometers is " << value*1000.0 << " meters." << endl; break; case '2': cout << "Meters=" << flush; cin >> value; cout << value << " meters is " << value/1000.0 << " kilometers." << endl; break; case '3': cout<< "Feet=" << flush; cin >> value; cout << value << " feet is " << value*0.3048 << " meters." << endl; break; case '4': cout<< "Meters=" << flush; cin >> value; cout << value << " meters is " << value/0.3048 << " feet." << endl; break; case '5': cout<< "Farenheit=" << flush; cin >> value; cout << value << " Farenheit is " << (value-32.0)*(5.0/9.0) << " Celsius." << endl; break; case '6': return 0; default: cout << "Unknown choice!" << endl; break; } } } int solvers () { // add your stuff here return 0; } int main () { char choice; float value; for ( ;; ) { cout << "1) Available converters" << endl << "2) Problem solvers" << endl << "3) Exit" << endl << "Select: " << flush; cin >> choice; switch ( choice ) { case '1': converters (); break; case '2': solvers (); break; case '3': return 0; default: cout << "Unknown choice!" << endl; } } }

OpenStudy (bahrom7893):

dang thanks!!

OpenStudy (bahrom7893):

now alchemista im about to post a new question.. teach me how to split the program there..

OpenStudy (anonymous):

Just study about the concept of functions in C++. How to define functions, declare the arguments etc.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!