+ 1

Function Main

let say the output that I want is :- (1) My information (2) List of cars (3) Wishlist (4) My order (5) Checkout (0) Exit Please choose a number : __ all of the number have their own function :- void MyInfo() void ListofCars() and so on .. for example i choose number 2, how can I return to main function ?

2nd Dec 2018, 7:43 AM
Syed Bob
9 odpowiedzi
+ 1
https://code.sololearn.com/cX53ItjX0FOW/?ref=app You need to make organization between all functions, you need to do it by yourself. The code I sent may give you the idea, check it out.
2nd Dec 2018, 8:37 AM
Mustafa K.
Mustafa K. - avatar
+ 2
alright thank you sir
2nd Dec 2018, 8:38 AM
Syed Bob
+ 2
wow, you're very brilliant sir. thank you very much for helping me out and for your time. Have a nice day sir ! :)
2nd Dec 2018, 8:43 AM
Syed Bob
+ 1
It already returns automatically. I mean, int main() { //some codes function1(); //other codes function2(); } int this example, some codes are executed first and then the program executes the codes in function1, after it finishes its job, it returns to main func, then executes other codes, after that, it executes the codes in function2. Finally program ends.
2nd Dec 2018, 7:52 AM
Mustafa K.
Mustafa K. - avatar
+ 1
i see, but what if the output after i entered ' 2 ' is (1) Lamborghini (2) Ferrari (3) Porche (9) Main menu can I do that ? or I can't go back after i enter the function ?
2nd Dec 2018, 7:56 AM
Syed Bob
+ 1
If you put all the functions in while loop (or any other loop) you can do it.
2nd Dec 2018, 8:24 AM
Mustafa K.
Mustafa K. - avatar
+ 1
but what will the code be ? I can't figured it out
2nd Dec 2018, 8:35 AM
Syed Bob
+ 1
In additon, you need to return to MainMenu function (which includes options) after every action. For example, user chose list of cars option, and this popped up, 1 Lamborghini 2 Ferrari 3 Porche 0 Main Menu Let's say user chose Ferrari option and, after you made some changes you need to return to main menu. I mean, you need to call MainMenu function.
2nd Dec 2018, 8:44 AM
Mustafa K.
Mustafa K. - avatar
+ 1
I see, understood. thank you again sir :)
2nd Dec 2018, 8:48 AM
Syed Bob