New Posts  All Forums:Forum Nav:

C++ restart program help! :) - Page 3

post #21 of 34
Thread Starter 
Quote:
Originally Posted by The Bartender Paradox View Post
You can do it with just a char. Yes starts with a y. When you cin >> tax_option it writes just the first letter of what ever was entered to tax_option. So if the input is yes or y tax_option will still get the value y. Of course if the user entered yes, the e and the s would still be in the input buffer. Since you are restarting the program it would probably be beneficial to clear the input buffer. You can do that by using cin.ignore(5, 'n') where the 5 indicates how many characters you would like to ignore, and the 'n' is alternatively what character you would like to stop on. So cin.ignore(5, 'n') says ignore the next five characters or up until the newline character, which ever comes first. Hope that helps
Thank you, but I still haven't figured out how to do the while loop. My question is 4 posts above.
2011
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom X4 955 BE @ 3.2Ghz Gigabyte 880GA-UD3H XFX 6870 Dual Fan  4Gb G.Skill Ripjaw 1333Mhz 
Hard DriveOptical DriveCoolingOS
80Gb Seagate SATA LG DVD+ Zalman CNPS 9700 Windows 7 64 bit 
MonitorKeyboardPowerCase
Asus VH238H Black 23" Full HD - LED Backlit Microsoft Media Pro Antec Earthwatts 600w Antec 900 (modded) 
MouseMouse Pad
Logitech MX518 Steelpad 5L 
  hide details  
Reply
2011
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom X4 955 BE @ 3.2Ghz Gigabyte 880GA-UD3H XFX 6870 Dual Fan  4Gb G.Skill Ripjaw 1333Mhz 
Hard DriveOptical DriveCoolingOS
80Gb Seagate SATA LG DVD+ Zalman CNPS 9700 Windows 7 64 bit 
MonitorKeyboardPowerCase
Asus VH238H Black 23" Full HD - LED Backlit Microsoft Media Pro Antec Earthwatts 600w Antec 900 (modded) 
MouseMouse Pad
Logitech MX518 Steelpad 5L 
  hide details  
Reply
post #22 of 34
Code:
int main ()   
{
    do{
    cout << "How much money do you want to convert?: ";
    cin >> money;
    cout << "Do you want to calculate tax? (y/n): ";
    cin >> tax_option;
    
    if(tax_option == 'y')
    {
           cout << "What % is the tax?: ";
           cin >> tax_number;  
    }

    convert_money(money, tax_number, tax_option);
    
    do{
        cout << "nnDo you want to restart? (y/n): ";
        cin >> quit;
    }while(quit != 'y' && quit != 'n');
    }while(quit == 'y');
}
The do while around the restart prompt forces them to type y or n
It goes to eleven
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6300 DS3 EVGA 8600GTS 2GB XMS2 DDR2-800 
Hard DriveOSMonitorKeyboard
1.294 TB Arch Linux/XP Samsung 226bw Eclipse II 
PowerCaseMouse
Corsair 520HX Lian-Li v1000B Plus G7 
  hide details  
Reply
It goes to eleven
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6300 DS3 EVGA 8600GTS 2GB XMS2 DDR2-800 
Hard DriveOSMonitorKeyboard
1.294 TB Arch Linux/XP Samsung 226bw Eclipse II 
PowerCaseMouse
Corsair 520HX Lian-Li v1000B Plus G7 
  hide details  
Reply
post #23 of 34
... speaking of currency converters, OS X has one in the dashboard ^_^

Next time I hit a code snag, I'm gonna ask here, this coding section is so active..
Jesus PC v5.3
(13 items)
 
  
CPUMotherboardGraphicsRAM
i7-950 Gigabyte X58A-UD3R 5850 GSkill 1600 MHz 4x4GB 
Hard DriveOptical DriveOSMonitor
3x1200.12 500GB RAID 0, 2x2TB Deskstar RAID 1 Samsung Writemaster SATA Gentoo, Windows 7 x64 3x 21.5" Samsungs 
PowerCaseMouse
Thermaltake 750W RocketPwn G500 
  hide details  
Reply
Jesus PC v5.3
(13 items)
 
  
CPUMotherboardGraphicsRAM
i7-950 Gigabyte X58A-UD3R 5850 GSkill 1600 MHz 4x4GB 
Hard DriveOptical DriveOSMonitor
3x1200.12 500GB RAID 0, 2x2TB Deskstar RAID 1 Samsung Writemaster SATA Gentoo, Windows 7 x64 3x 21.5" Samsungs 
PowerCaseMouse
Thermaltake 750W RocketPwn G500 
  hide details  
Reply
post #24 of 34
Quote:
Originally Posted by FearMeansControl View Post
... speaking of currency converters, OS X has one in the dashboard ^_^

Next time I hit a code snag, I'm gonna ask here, this coding section is so active..
and if you're online, Google's got one too: 149.99 USD in GBP
RAWR
(13 items)
 
Home Server
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-4790k msi z97 gaming 7 gtx 760 4gb 32GB GSkill  
Hard DriveHard DriveCoolingOS
Kingston HyperX 3K 120GB SSD Hitachi 2TB Cooler Master Hyper 212+ Windows 8.1 Pro 
MonitorKeyboardPowerCase
Vizio M492-b2 Logitech Wireless  Corsair HX620 NZXT Phantom White 
Mouse
Logitech Wireless 
  hide details  
Reply
RAWR
(13 items)
 
Home Server
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-4790k msi z97 gaming 7 gtx 760 4gb 32GB GSkill  
Hard DriveHard DriveCoolingOS
Kingston HyperX 3K 120GB SSD Hitachi 2TB Cooler Master Hyper 212+ Windows 8.1 Pro 
MonitorKeyboardPowerCase
Vizio M492-b2 Logitech Wireless  Corsair HX620 NZXT Phantom White 
Mouse
Logitech Wireless 
  hide details  
Reply
post #25 of 34
Thread Starter 
Thanks for all your help guys. I know Google has one like this online...but this was just a test.

I don't really see any big uses for C++...could someone name some to me? :S
2011
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom X4 955 BE @ 3.2Ghz Gigabyte 880GA-UD3H XFX 6870 Dual Fan  4Gb G.Skill Ripjaw 1333Mhz 
Hard DriveOptical DriveCoolingOS
80Gb Seagate SATA LG DVD+ Zalman CNPS 9700 Windows 7 64 bit 
MonitorKeyboardPowerCase
Asus VH238H Black 23" Full HD - LED Backlit Microsoft Media Pro Antec Earthwatts 600w Antec 900 (modded) 
MouseMouse Pad
Logitech MX518 Steelpad 5L 
  hide details  
Reply
2011
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom X4 955 BE @ 3.2Ghz Gigabyte 880GA-UD3H XFX 6870 Dual Fan  4Gb G.Skill Ripjaw 1333Mhz 
Hard DriveOptical DriveCoolingOS
80Gb Seagate SATA LG DVD+ Zalman CNPS 9700 Windows 7 64 bit 
MonitorKeyboardPowerCase
Asus VH238H Black 23" Full HD - LED Backlit Microsoft Media Pro Antec Earthwatts 600w Antec 900 (modded) 
MouseMouse Pad
Logitech MX518 Steelpad 5L 
  hide details  
Reply
post #26 of 34
Quote:
Originally Posted by Starholdest View Post
Thanks for all your help guys. I know Google has one like this online...but this was just a test.

I don't really see any big uses for C++...could someone name some to me? :S
Big things like Operating systems, office suites, engineering tools, etc.
½
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD A64 3500+ Winchester DFI nF4 SLi-DR EVGA 7800GT OCZ 4000VX 
Hard DriveOptical DriveOSMonitor
Maxtor 300Gb 16Mb Buffer Spinney one XP Pro SOYO LCD 
KeyboardPowerCaseMouse
Broken Somewhat OCZ PowerStream 520W None Old 
Mouse Pad
Pad? AHAAHAHAH 
  hide details  
Reply
½
(13 items)
 
  
CPUMotherboardGraphicsRAM
AMD A64 3500+ Winchester DFI nF4 SLi-DR EVGA 7800GT OCZ 4000VX 
Hard DriveOptical DriveOSMonitor
Maxtor 300Gb 16Mb Buffer Spinney one XP Pro SOYO LCD 
KeyboardPowerCaseMouse
Broken Somewhat OCZ PowerStream 520W None Old 
Mouse Pad
Pad? AHAAHAHAH 
  hide details  
Reply
post #27 of 34
Quote:
Originally Posted by Starholdest View Post
Thanks for all your help guys. I know Google has one like this online...but this was just a test.

I don't really see any big uses for C++...could someone name some to me? :S
Are you serious? It has all of the speed, efficiency, and low-levelness of C and all of the advantages and simplicity that Object-oriented languages such as Java give.
It goes to eleven
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6300 DS3 EVGA 8600GTS 2GB XMS2 DDR2-800 
Hard DriveOSMonitorKeyboard
1.294 TB Arch Linux/XP Samsung 226bw Eclipse II 
PowerCaseMouse
Corsair 520HX Lian-Li v1000B Plus G7 
  hide details  
Reply
It goes to eleven
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6300 DS3 EVGA 8600GTS 2GB XMS2 DDR2-800 
Hard DriveOSMonitorKeyboard
1.294 TB Arch Linux/XP Samsung 226bw Eclipse II 
PowerCaseMouse
Corsair 520HX Lian-Li v1000B Plus G7 
  hide details  
Reply
post #28 of 34
Quote:
Originally Posted by Starholdest View Post
Thanks for all your help guys. I know Google has one like this online...but this was just a test.

I don't really see any big uses for C++...could someone name some to me? :S
what good is it? you use it to write programs... ANY program.
RAWR
(13 items)
 
Home Server
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-4790k msi z97 gaming 7 gtx 760 4gb 32GB GSkill  
Hard DriveHard DriveCoolingOS
Kingston HyperX 3K 120GB SSD Hitachi 2TB Cooler Master Hyper 212+ Windows 8.1 Pro 
MonitorKeyboardPowerCase
Vizio M492-b2 Logitech Wireless  Corsair HX620 NZXT Phantom White 
Mouse
Logitech Wireless 
  hide details  
Reply
RAWR
(13 items)
 
Home Server
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-4790k msi z97 gaming 7 gtx 760 4gb 32GB GSkill  
Hard DriveHard DriveCoolingOS
Kingston HyperX 3K 120GB SSD Hitachi 2TB Cooler Master Hyper 212+ Windows 8.1 Pro 
MonitorKeyboardPowerCase
Vizio M492-b2 Logitech Wireless  Corsair HX620 NZXT Phantom White 
Mouse
Logitech Wireless 
  hide details  
Reply
post #29 of 34
Thread Starter 
Quote:
Originally Posted by hometoast View Post
what good is it? you use it to write programs... ANY program.
Can it be used to write programs that aren't DOS based? I hope that made some sense...
2011
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom X4 955 BE @ 3.2Ghz Gigabyte 880GA-UD3H XFX 6870 Dual Fan  4Gb G.Skill Ripjaw 1333Mhz 
Hard DriveOptical DriveCoolingOS
80Gb Seagate SATA LG DVD+ Zalman CNPS 9700 Windows 7 64 bit 
MonitorKeyboardPowerCase
Asus VH238H Black 23" Full HD - LED Backlit Microsoft Media Pro Antec Earthwatts 600w Antec 900 (modded) 
MouseMouse Pad
Logitech MX518 Steelpad 5L 
  hide details  
Reply
2011
(14 items)
 
  
CPUMotherboardGraphicsRAM
Phenom X4 955 BE @ 3.2Ghz Gigabyte 880GA-UD3H XFX 6870 Dual Fan  4Gb G.Skill Ripjaw 1333Mhz 
Hard DriveOptical DriveCoolingOS
80Gb Seagate SATA LG DVD+ Zalman CNPS 9700 Windows 7 64 bit 
MonitorKeyboardPowerCase
Asus VH238H Black 23" Full HD - LED Backlit Microsoft Media Pro Antec Earthwatts 600w Antec 900 (modded) 
MouseMouse Pad
Logitech MX518 Steelpad 5L 
  hide details  
Reply
post #30 of 34
Quote:
Originally Posted by Starholdest View Post
Can it be used to write programs that aren't DOS based? I hope that made some sense...
You can use a compiler to compile the C code into machine code. Machine code is binary code that can be executed by the CPU directly.
It goes to eleven
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6300 DS3 EVGA 8600GTS 2GB XMS2 DDR2-800 
Hard DriveOSMonitorKeyboard
1.294 TB Arch Linux/XP Samsung 226bw Eclipse II 
PowerCaseMouse
Corsair 520HX Lian-Li v1000B Plus G7 
  hide details  
Reply
It goes to eleven
(13 items)
 
  
CPUMotherboardGraphicsRAM
E6300 DS3 EVGA 8600GTS 2GB XMS2 DDR2-800 
Hard DriveOSMonitorKeyboard
1.294 TB Arch Linux/XP Samsung 226bw Eclipse II 
PowerCaseMouse
Corsair 520HX Lian-Li v1000B Plus G7 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Application Programming