multiple codes in One Program

closed account (2Up4izwU)
Hi every1

i have more than one application(codes) - calculator,converter,math functions. so how could i compile them together and display a list for the user to chose one of the functions? so that the user can select a function and run that selective code ?

Thanks in forward
Last edited on
By putting the code for them in different functions and calling those functions as required.
closed account (2Up4izwU)
how ?
closed account (2Up4izwU)
oh not this again .. i need to know how exactly
amazing.

Really, don't ever try to learn to code. Obviously you'll never do. (with this attitude)
Last edited on
Here is an example. If this was beyond you and you couldn't think of it yourself, you need to go back and learn how to think about solving problems.

1
2
3
4
5
6
7
8
9
10
11
12
int main()
{
  char input;
 cout << "Press 1 for adding, 2 for multiplication";
  cin >> input;

  if (input == '1')
  {  addition(); }

  if (input == '2')
  {  multiplication(); }
}
closed account (2Up4izwU)
was that hard ??
;)

have to work
Peace Volk and Thx
was that hard ??

It was clearly beyond your abilities.
Last edited on
have to work


LAUGH OUT LOUD
Last edited on
closed account (2Up4izwU)
guys one more Q

how can i call the main menu the int main ?

its not working

if (input == '0')
{ int main(); }


to go back to the menu
Last edited on
You're not allowed to call main from your code.
And that isn't a function call.
closed account (2Up4izwU)
in this case how could i allow the user to display the choices again ??
In your quest to learn C++, I'm sure you've come across the concept of a loop. This would be a great time to employ it.
closed account (2Up4izwU)
yeah it would be grater to tell me how : (

hmm i cant call the main so how can i employ looop
Last edited on
closed account (2Up4izwU)
i didn't use Switch so should i write it again in Switch Statement ?
closed account (2Up4izwU)
i dont want to post my code here for public cause its home work ;)

closed account (2Up4izwU)
did u got my PM?
If you don't want to post your code on a public forum, please stop wasting the time of those who might help you in the public forum. Pay for a tutor. Use the search function. Learn to google. Exercise your brain.
Topic archived. No new replies allowed.