+ 1

how to make CASH REGISTER application?

23rd Aug 2016, 5:32 PM
Mark Spencer Montalbo
Mark Spencer Montalbo - avatar
13 ответов
+ 2
Hi. Sorry for the late reply. I have changed your program a LOT, because the things you wanted could not be easily inplemented without the use of functions. I have also done a lot of clearing up. Here's the code: (Not set to public) (Link updated due to newer answers) http://code.sololearn.com/cc3Nh563fTrd/#cpp WHAT I'VE DONE: • Removed a lot of unnecessary endls and replaced with \n. As your program isn't very complex when it comes to input, there will be not much of an advantage using endl over \n. This has cleared up a lot. • Removed the char array for name, and changed it to a string. The char array is a waste of memory when you coule just have a simple string. • Changed sum to a float, so that it can accept currency decimals. • Removed unnecessary variables that were not needed in the program (n, sub, value, c and price). • Introduced 2 new functions: Fmenu and Smenu (first and second menu). These functions allow the user to easily switch between the two, if they wanted to do something such as returning to the previous menu. • Introduced 2 new ints, Fchoice and Schoice (first and second choice). These did not need to be a string. If you have any questions about the code at all please feel free the comment here, I'll be glad to help. Apologies that so much has changed.
24th Aug 2016, 4:17 PM
Cohen Creber
Cohen Creber - avatar
+ 2
Good! I'm glad it helped out😁 again, just message here if you need anything about this particular program.
25th Aug 2016, 4:26 PM
Cohen Creber
Cohen Creber - avatar
+ 2
Hey there. Your link doesn't seem to be working anymore, make sure you keep the code saved until your problem is solved, so that people can access the links :) Post a link here again once you're done.
30th Aug 2016, 2:39 PM
Cohen Creber
Cohen Creber - avatar
+ 1
You need to elaborate. What do you want this application to do?
24th Aug 2016, 10:09 AM
Cohen Creber
Cohen Creber - avatar
+ 1
Thank you very much sir Cohen Creber to develop my program,. it was so very Helpful to me,. i got more idea about C++
25th Aug 2016, 4:18 PM
Mark Spencer Montalbo
Mark Spencer Montalbo - avatar
+ 1
(Not set to public) http://code.sololearn.com/cc3Nh563fTrd/#cpp WHAT I'VE DONE: • String paid was unnecessary, as you was only printing out the string once. It would be viable if you were printing the same string out multiple times. • Removed #include <limits>, as I believe it to be unnecessary. • Replaced one do/while loop in main with a while loop, do/while was not needed. • General clean-up. Come back if you need anything else😆
30th Aug 2016, 7:49 PM
Cohen Creber
Cohen Creber - avatar
+ 1
if i enter a Characters in Smenu or Schoice there was continue looping,. unlike in Fmenu,. can you fix my code sir?
31st Aug 2016, 1:23 AM
Mark Spencer Montalbo
Mark Spencer Montalbo - avatar
0
// Spenxsz.program #include <iostream> #include <string> using namespace std; int main() { string Fmenu; int n, sub = 0, sum = 0, value, c, price; char name[30]; cout << "WELCOME TO MY STORE" << endl; cout << endl; cout << "Please enter your name: "; cin >> name; cout << endl; cout << "Hi" << " " << name << "..." << endl << "Please pick item below" << endl; cout << endl; cout << endl; cout << "ITEMS" << endl; cout << "[1] Chasis" << endl << "[2] Processor" << endl << "[3] Mobo" << endl << "[4] GPU" << endl << "[5] RAM" << endl << "[6] HDD" << endl << "[7] SSD" << endl << "[8] PSU" << endl << "[9] Optical Drive" << endl << "[0] Exit" << endl; cout << endl << "Enter the Number to Select" << endl; getline(cin, Fmenu); cin >> Fmenu; if (Fmenu == "1") { cout << endl; cout << "CHASIS" << endl << " [1] Aerocool GT Black Gaming . . . . . . . . . P 1,250.00" << endl << " [2] Deepcool SMARTER . . . . . . . . . . . . . P 1,250.00" << endl << " [3] Sharkoon VG5-W . . . . . . . . . . . . . . P 1,790.00" << endl << " [4] Sharkoon VS4-S . . . . . . . . . . . . . . P 1,200.00" << endl << " [5] Tecware Infinity Mid Tower Gaming Case . . P 1,240.00" << endl << " [0]Return" << endl; } else if (Fmenu == "2") { cout << endl; cout << "PROCESSOR" << endl << " [1] AMD Kaveri A8-7600 . . . . . . . . . . . . P 3,550.00" << endl << " [2] AMD Kaveri A10-7850. . . . . . . . . . . . P 6,850.00" << endl << " [3] Intel Core i7-6700 . . . . . . . . . . . . P 16,500.00" << endl << " [0]Return" << endl; } else { cout << endl; cout << "- - - - - - - Please try again - - - - - - -" << endl; } cout << endl << endl << endl; cout << "Thanks for using of my Application" << endl << "Mr/Ms" << " " << name << endl; system("pause"); }
24th Aug 2016, 2:40 PM
Mark Spencer Montalbo
Mark Spencer Montalbo - avatar
0
sir,. can you Help me again? 😁
26th Aug 2016, 4:06 PM
Mark Spencer Montalbo
Mark Spencer Montalbo - avatar
26th Aug 2016, 4:18 PM
Mark Spencer Montalbo
Mark Spencer Montalbo - avatar
0
http://www.sololearn.com/app/cplusplus/playground/cSj0i1IWhu8g/ sir,. can you fix some errors?
30th Aug 2016, 1:55 PM
Mark Spencer Montalbo
Mark Spencer Montalbo - avatar
30th Aug 2016, 4:12 PM
Mark Spencer Montalbo
Mark Spencer Montalbo - avatar
- 1
if i pick [3] Sharkoon VG5-W and [1] AMD Kaveri A8-7600,. how to get the Total that i want to buy?
24th Aug 2016, 2:45 PM
Mark Spencer Montalbo
Mark Spencer Montalbo - avatar