Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- To calculate speed do Distance divided by time
- */
- #include <iostream>
- using namespace std;
- bool
- ReDo ()
- {
- string YesOrNo;
- cout << "Want to go back to main?\n";
- cin >> YesOrNo;
- if (YesOrNo == "Y" || YesOrNo == "y" || YesOrNo == "Yes"
- || YesOrNo == "yes")
- {
- return true;
- }
- else if (YesOrNo == "N" || YesOrNo == "n" || YesOrNo == "No"
- || YesOrNo == "no")
- {
- return false;
- }
- else
- {
- ReDo ();
- }
- }
- bool
- USD ()
- {
- string Type;
- cout << "To?\n";
- cout << "CAD (Canadian currency)\n" << "Pound (British currency)\n";
- cin >> Type;
- if (Type == "CAD" || Type == "cad")
- {
- int USDCASH;
- int CADCASH;
- cout << "Enter USD amount: ";
- cin >> USDCASH;
- CADCASH = (USDCASH / 1.33);
- cout << CADCASH << " CAD\n";
- return true;
- }
- else if (Type == "Pound" || Type == "pound")
- {
- int USDCASH;
- int POUNDCASH;
- cout << "Enter USD amount: ";
- cin >> USDCASH;
- POUNDCASH = (USDCASH * 0.77);
- cout << POUNDCASH << " POUNDS\n";
- }
- else
- {
- return false;
- }
- }
- void
- Cash ()
- {
- string Type;
- cout << "Start from?\n";
- cout << "USD\n" << "CAD (Canadian currency)\n" <<
- "Pound (British currency)\n";
- cin >> Type;
- if (Type == "USD" || Type == "usd")
- {
- if (USD () == true)
- {
- cout << "Successful!\n";
- }
- else
- {
- cout << "UnSuccessful.\n";
- }
- }
- }
- int
- main ()
- {
- string Choice;
- cout << "Which calculator?\n";
- cout << "Speed\n" << "Cash\n" << "Normal calculator\n";
- cin >> Choice;
- if (Choice == "Cash" || Choice == "cash")
- {
- Cash ();
- }
- if (ReDo() == true) {
- main();
- } else {
- cout << "Goodbye!\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement