Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming

Reply
 
LinkBack Thread Tools
Old 02-20-08   #1 (permalink)
AMD Overclocker
 
Starholdest's Avatar
 
amd nvidia

Join Date: Mar 2007
Location: █♣█
Posts: 939
Blog Entries: 1

Rep: 43 Starholdest is acknowledged by some
Unique Rep: 38
Hardware Reviews: 1
Trader Rating: 0
Default C++ restart program help! :)

Hey guys. I made a currency converter program and I was wondering what function I use to make it restart? I have it so that it asks if you want to quit or not, and if the person answers with either 'y' or 'yes', it will quit, but now I need the function so that it will restart if they enter 'n' or 'no'!

Thanks for the help, guys!
Elliott
__________________

Volkswagen Enthusiasts of OCN


Aumotocnic "An unfortunate member of the overclock.net insomnia club"

Quebec Overclockers - 8019 in 3dMark06

s939 Manny 4600+ @ 2809Mhz @ 1.425V (9 hours Orthos blend test stable - 24/7 Usage) - http://valid.x86-secret.com/show_oc.php?id=289741
@ 2945Mhz @ 1.45V - http://valid.x86-secret.com/show_oc.php?id=276669

System: Beast from the East
CPU
AMD x2 4600+ @ 2.8Ghz
Motherboard
Asus A8N-SLI SE
Memory
2GB Kingston Value DDR400
Graphics Card
Asus 8800GTS 320MB
Hard Drive
80G Seagate SATA
Sound Card
SoundBlaster Audigy SE
Power Supply
Thermaltake Purepower 500W
Case
Antec 900 (modded)
CPU cooling
AS5 + Zalman CNPS9700 LED
GPU cooling
Stock
OS
Windows Vista Ultimate
Monitor
Samsung Syncmaster 730B (17" yay!)
Starholdest is offline Starholdest's Gallery   Reply With Quote
Old 02-20-08   #2 (permalink)
Multi-Quote King
 
The Hundred Gunner's Avatar
 
amd nvidia

Join Date: Jul 2006
Posts: 8,672

Rep: 653 The Hundred Gunner is becoming famousThe Hundred Gunner is becoming famousThe Hundred Gunner is becoming famousThe Hundred Gunner is becoming famousThe Hundred Gunner is becoming famousThe Hundred Gunner is becoming famous
Unique Rep: 371
Folding Team Rank: 1269
Trader Rating: 0
Default

Um... I'm not that good at C programming (I'm just learning C), but my book had an example where you would have a "while" loop statement, and it would ask you to enter a number to proceed with the equation it solves, or press 0 to quit. So maybe you can use a "while" loop and have someone press "0" if they want to quit, or anything else to proceed.

Just an idea. I'm not especially good at this.
__________________
"But you would be amazed by how many people think that the only reason to have a computer is to play games, and that playing games is all that anyone with a computer does." - dangerousHobo

"Linux is everywhere, it is all around us, even now in this very room. You can see it when you look out your window, or you turn on your television. You can feel it when you go to work, when you go to church, when you pay your taxes. " - mbp

"I have used a mac before. And they still don't have right click I mean come on." - aakar

Blah, blah, can't hear you

System: The Shuttle Has Landed
CPU
Athlon 64 3800+ @2.785GHz
Motherboard
Shuttle
Memory
2GB OCZ
Graphics Card
7950GT
Hard Drive
320GB Seagate in Ext. Case
Sound Card
On-board
Power Supply
250W Shuttle "Elanpower"
Case
Shuttle Glamour xPC
CPU cooling
Shuttle "ICE2"
GPU cooling
Stock
OS
Censored to avoid flaming
Monitor
HP M70
The Hundred Gunner is offline I fold for Overclock.net Overclocked Account   Reply With Quote
Old 02-20-08   #3 (permalink)
Off By 340 Undecillion
 
The Bartender Paradox's Avatar
 
amd nvidia

Join Date: Oct 2004
Location: Portland, Oregon
Posts: 2,338

Rep: 306 The Bartender Paradox is a proven memberThe Bartender Paradox is a proven memberThe Bartender Paradox is a proven memberThe Bartender Paradox is a proven member
Unique Rep: 234
Folding Team Rank: 448
Hardware Reviews: 1
Trader Rating: 3
Default

Use a do while loop that encases most of the program.
__________________

A rocket powered land shark attached to a giant freakin' laser beam.
Congratulations! You have found the secret text! You get a cookie.

System: My System
CPU
AMD A64 3500+ Winchester
Motherboard
DFI nF4 SLi-DR
Memory
OCZ 4000VX
Graphics Card
EVGA 7800GT
Hard Drive
Maxtor 300Gb 16Mb Buffer
Sound Card
computers make sounds?
Power Supply
OCZ PowerStream 520W
Case
None
CPU cooling
Big
GPU cooling
Bigger
OS
XP Pro
Monitor
SOYO LCD
The Bartender Paradox is offline I fold for Overclock.net Overclocked Account The Bartender Paradox's Gallery   Reply With Quote
Old 02-20-08   #4 (permalink)
Linux Lobbyist
 
FearMeansControl's Avatar
 
intel nvidia

Join Date: Aug 2007
Location: Wrong Island, NY
Posts: 1,132

Rep: 76 FearMeansControl is acknowledged by some
Unique Rep: 66
Folding Team Rank: 51
Trader Rating: 2
Default

yeah, do a while statement that re-runs the program until the user answers no

while (userInput != y || userInput != Yes)
{
::call initial function::
}
__________________
Quote:
Originally Posted by ENTERPRISE View Post
I would reccomend opening task manager and closing the process ''IntelFanboy.exe''
Q6600
(450x8) (417x9) (425x9)

System: Jesus PC v5.3
CPU
Q6600
Motherboard
Gigabyte X38-DS4
Memory
OCZ PC-8000 4x2 GB
Graphics Card
Quadro FX-4600 & FX-1400
Hard Drive
3x2500JS RAID 0, 2x7200.11 500GB RAID 1
Sound Card
Presonus Firepod + Yamaha HS-5M's
Power Supply
OCZ StealthxStream 600W
Case
RocketPwn
CPU cooling
Fuzion v2, mcw-30, GTX 360, D5, CD Waterfall Res.
GPU cooling
Stock, re-applied with AS5
OS
Gentoo, XP x64
Monitor
Samsung Syncmaster 2253LW + 2x17" LCD's
FearMeansControl is offline I fold for Overclock.net   Reply With Quote
Old 02-20-08   #5 (permalink)
AMD Overclocker
 
Starholdest's Avatar
 
amd nvidia

Join Date: Mar 2007
Location: █♣█
Posts: 939
Blog Entries: 1

Rep: 43 Starholdest is acknowledged by some
Unique Rep: 38
Hardware Reviews: 1
Trader Rating: 0
Default

Quote:
Originally Posted by The Hundred Gunner View Post
Um... I'm not that good at C programming (I'm just learning C), but my book had an example where you would have a "while" loop statement, and it would ask you to enter a number to proceed with the equation it solves, or press 0 to quit. So maybe you can use a "while" loop and have someone press "0" if they want to quit, or anything else to proceed.

Just an idea. I'm not especially good at this.
Thanks but I'm quite new at this too...

Quote:
Originally Posted by The Bartender Paradox View Post
Use a do while loop that encases most of the program.
What do you mean? :S
__________________

Volkswagen Enthusiasts of OCN


Aumotocnic "An unfortunate member of the overclock.net insomnia club"

Quebec Overclockers - 8019 in 3dMark06

s939 Manny 4600+ @ 2809Mhz @ 1.425V (9 hours Orthos blend test stable - 24/7 Usage) - http://valid.x86-secret.com/show_oc.php?id=289741
@ 2945Mhz @ 1.45V - http://valid.x86-secret.com/show_oc.php?id=276669

System: Beast from the East
CPU
AMD x2 4600+ @ 2.8Ghz
Motherboard
Asus A8N-SLI SE
Memory
2GB Kingston Value DDR400
Graphics Card
Asus 8800GTS 320MB
Hard Drive
80G Seagate SATA
Sound Card
SoundBlaster Audigy SE
Power Supply
Thermaltake Purepower 500W
Case
Antec 900 (modded)
CPU cooling
AS5 + Zalman CNPS9700 LED
GPU cooling
Stock
OS
Windows Vista Ultimate
Monitor
Samsung Syncmaster 730B (17" yay!)
Starholdest is offline Starholdest's Gallery   Reply With Quote
Old 02-20-08   #6 (permalink)
Linux Lobbyist
 
FearMeansControl's Avatar
 
intel nvidia

Join Date: Aug 2007
Location: Wrong Island, NY
Posts: 1,132

Rep: 76 FearMeansControl is acknowledged by some
Unique Rep: 66
Folding Team Rank: 51
Trader Rating: 2
Default

he's saying that you start the while statement in your main function, so that while userInput != y || userInput != yes, the program will continue executing until kingdom come

*edit* do you have your source?
__________________
Quote:
Originally Posted by ENTERPRISE View Post
I would reccomend opening task manager and closing the process ''IntelFanboy.exe''
Q6600
(450x8) (417x9) (425x9)

System: Jesus PC v5.3
CPU
Q6600
Motherboard
Gigabyte X38-DS4
Memory
OCZ PC-8000 4x2 GB
Graphics Card
Quadro FX-4600 & FX-1400
Hard Drive
3x2500JS RAID 0, 2x7200.11 500GB RAID 1
Sound Card
Presonus Firepod + Yamaha HS-5M's
Power Supply
OCZ StealthxStream 600W
Case
RocketPwn
CPU cooling
Fuzion v2, mcw-30, GTX 360, D5, CD Waterfall Res.
GPU cooling
Stock, re-applied with AS5
OS
Gentoo, XP x64
Monitor
Samsung Syncmaster 2253LW + 2x17" LCD's
FearMeansControl is offline I fold for Overclock.net   Reply With Quote
Old 02-20-08   #7 (permalink)
AMD Overclocker
 
Starholdest's Avatar
 
amd nvidia

Join Date: Mar 2007
Location: █♣█
Posts: 939
Blog Entries: 1

Rep: 43 Starholdest is acknowledged by some
Unique Rep: 38
Hardware Reviews: 1
Trader Rating: 0
Default

Quote:
Originally Posted by FearMeansControl View Post
he's saying that you start the while statement in your main function, so that while userInput != y || userInput != yes, the program will continue executing until kingdom come

*edit* do you have your source?
Oh...nevermind all I had to do was main();

Lol thanks anyways guys.
__________________

Volkswagen Enthusiasts of OCN


Aumotocnic "An unfortunate member of the overclock.net insomnia club"

Quebec Overclockers - 8019 in 3dMark06

s939 Manny 4600+ @ 2809Mhz @ 1.425V (9 hours Orthos blend test stable - 24/7 Usage) - http://valid.x86-secret.com/show_oc.php?id=289741
@ 2945Mhz @ 1.45V - http://valid.x86-secret.com/show_oc.php?id=276669

System: Beast from the East
CPU
AMD x2 4600+ @ 2.8Ghz
Motherboard
Asus A8N-SLI SE
Memory
2GB Kingston Value DDR400
Graphics Card
Asus 8800GTS 320MB
Hard Drive
80G Seagate SATA
Sound Card
SoundBlaster Audigy SE
Power Supply
Thermaltake Purepower 500W
Case
Antec 900 (modded)
CPU cooling
AS5 + Zalman CNPS9700 LED
GPU cooling
Stock
OS
Windows Vista Ultimate
Monitor
Samsung Syncmaster 730B (17" yay!)
Starholdest is offline Starholdest's Gallery   Reply With Quote
Old 02-20-08   #8 (permalink)
Off By 340 Undecillion
 
The Bartender Paradox's Avatar
 
amd nvidia

Join Date: Oct 2004
Location: Portland, Oregon
Posts: 2,338

Rep: 306 The Bartender Paradox is a proven memberThe Bartender Paradox is a proven memberThe Bartender Paradox is a proven memberThe Bartender Paradox is a proven member
Unique Rep: 234
Folding Team Rank: 448
Hardware Reviews: 1
Trader Rating: 3
Default

Quote:
Originally Posted by Starholdest View Post
What do you mean? :S
int main();
{
//declare variables
//welcome message & other things you don't want repeated

do
{
//program that you want repeated
.
.
.
.
.

//ask if you want to repeat and store the answer in, oh lets say 'ans'

}
while(ans == y || ans == yes)

//all closing things

return 0;
}

Hopefully that helps. Ask more if you need it
__________________

A rocket powered land shark attached to a giant freakin' laser beam.
Congratulations! You have found the secret text! You get a cookie.

System: My System
CPU
AMD A64 3500+ Winchester
Motherboard
DFI nF4 SLi-DR
Memory
OCZ 4000VX
Graphics Card
EVGA 7800GT
Hard Drive
Maxtor 300Gb 16Mb Buffer
Sound Card
computers make sounds?
Power Supply
OCZ PowerStream 520W
Case
None
CPU cooling
Big
GPU cooling
Bigger
OS
XP Pro
Monitor
SOYO LCD
The Bartender Paradox is offline I fold for Overclock.net Overclocked Account The Bartender Paradox's Gallery   Reply With Quote
Old 02-20-08   #9 (permalink)
Linux Lobbyist
 
FearMeansControl's Avatar
 
intel nvidia

Join Date: Aug 2007
Location: Wrong Island, NY
Posts: 1,132

Rep: 76 FearMeansControl is acknowledged by some
Unique Rep: 66
Folding Team Rank: 51
Trader Rating: 2
Default

hah! +rep for spending time on something silly like that, we all do it [not for teh lulz]!
__________________
Quote:
Originally Posted by ENTERPRISE View Post
I would reccomend opening task manager and closing the process ''IntelFanboy.exe''
Q6600
(450x8) (417x9) (425x9)

System: Jesus PC v5.3
CPU
Q6600
Motherboard
Gigabyte X38-DS4
Memory
OCZ PC-8000 4x2 GB
Graphics Card
Quadro FX-4600 & FX-1400
Hard Drive
3x2500JS RAID 0, 2x7200.11 500GB RAID 1
Sound Card
Presonus Firepod + Yamaha HS-5M's
Power Supply
OCZ StealthxStream 600W
Case
RocketPwn
CPU cooling
Fuzion v2, mcw-30, GTX 360, D5, CD Waterfall Res.
GPU cooling
Stock, re-applied with AS5
OS
Gentoo, XP x64
Monitor
Samsung Syncmaster 2253LW + 2x17" LCD's
FearMeansControl is offline I fold for Overclock.net   Reply With Quote
Old 02-20-08   #10 (permalink)
Every base is base 10
 
rabidgnome229's Avatar
 
intel nvidia

Join Date: Feb 2006
Location: Pittsburgh
Posts: 5,009
Blog Entries: 1

Rep: 566 rabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famousrabidgnome229 is becoming famous
Unique Rep: 338
FAQs Submitted: 6
Trader Rating: 5
Default

Quote:
Originally Posted by Starholdest View Post
Oh...nevermind all I had to do was main();

Lol thanks anyways guys.
I would suggest what bartender posted rather than calling main again. Your way recursively calls main, which wastes memory. The program is trivial so it doesn't really matter, but bartender's post is better coding practice
__________________
BIG BROTHER
Apple doesn't love you

IS WATCHING

System: It goes to eleven
CPU
E6300
Motherboard
DS3
Memory
2GB XMS2 DDR2-800
Graphics Card
EVGA 8600GTS
Hard Drive
1.294 TB
Sound Card
Audigy 2 ZS
Power Supply
Corsair 520HX
Case
Lian-Li v1000B Plus
CPU cooling
TTBT
GPU cooling
Thermalright V2
OS
Arch Linux/XP
Monitor
Samsung 226bw
rabidgnome229 is offline Overclocked Account   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 03:05 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.96285 seconds with 8 queries