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

Reply
 
LinkBack Thread Tools
Old 09-27-09   #1 (permalink)
AMD Overclocker
 
amd nvidia

Join Date: Apr 2009
Posts: 433

Rep: 19 godsgift2dagame Unknown
Unique Rep: 17
Trader Rating: 0
Default How to double int every time?

Hey guys,

How would I go about doubling something EVERY instance. If I enter 1, x = 1. If I enter 2, x = 2. If I enter 3, x= 3 and so on and so forth. Trying to test something out.

Thanks guys!
__________________
System: $775
CPU
Phenom II 720
Motherboard
Gigabyte MA790X-UD4P
Memory
4GB OCZ Reaper DDR2 1150
Hard Drive
250GB Seagate Barracuda 7200.10 x 2
Power Supply
PC Power & Cooling 610W
Case
Antec 300
CPU cooling
XIGMATEK Dark Knight-S1283V
OS
Vista 64-bit
godsgift2dagame is offline   Reply With Quote
Old 09-27-09   #2 (permalink)
Overclocker
 
B-80's Avatar
 
intel nvidia

Join Date: Oct 2006
Location: Levittown,PA / Penn State
Posts: 1,926

Rep: 86 B-80 is acknowledged by some
Unique Rep: 76
Trader Rating: 0
Default

what do you mean?

do{
x *= 2;
}while(whatever)
__________________

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

-- / T_he Rad / iohead F_a/n Club_--

Crucial Ballistix Club

System: The Mediocre Guy
CPU
E7200 @ 3.8ghz
Motherboard
Gigabyte P45 DS3
Memory
4GB Corsair XMS2
Graphics Card
Geforce 8800 GTS (600/900)
Hard Drive
250 gb hitachi Deskstar + 120gb Seagate
Power Supply
PC Power & Cooling Silencer 750 Quad
Case
Aspire X-Cruiser Black
CPU cooling
Zalman 9700
GPU cooling
Stock
OS
Windows xp
Monitor
ViewSonic Optiquest 20.1 inch 1650x1058
B-80 is offline   Reply With Quote
Old 09-27-09   #3 (permalink)
PC Gamer
 
Nhb93's Avatar
 
amd nvidia

Join Date: Aug 2009
Posts: 313

Rep: 18 Nhb93 Unknown
Unique Rep: 17
Trader Rating: 0
Default

You asked about doubling, yet you said if you enter 1 you get 1, enter 2, get 2, etc. I'm missing something, but B-80 would be correct in his x *= 2 method while performing a loop.

System: HAFaestus (Alienware ported into HAF 932)
CPU
AMD Athlon 64 X2 6000+
Motherboard
Foxconn nForce 590 SLI
Memory
4GB
Graphics Card
GeForce 8800 GTX
Hard Drive
250GB Seagate + 750GB WD
Sound Card
Onboard
Power Supply
HIPRO HP-W700WC3 LF 700W
Case
Cooler Master HAF 932
CPU cooling
TRUE + Ceramique + San Ace 120
GPU cooling
Stock
OS
Windows 7 Professional 64-bit/Windows XP 32-bit
Monitor
Samsung SyncMaster 930B
Nhb93 is offline   Reply With Quote
Old 09-27-09   #4 (permalink)
AMD Overclocker
 
amd nvidia

Join Date: Apr 2009
Posts: 433

Rep: 19 godsgift2dagame Unknown
Unique Rep: 17
Trader Rating: 0
Default

basically, how do I double a penny for 30 days? That type of program.

First day you earn 1 cent.

Second day 2 cents.

Third day 4 cents.

Fourth day 8 cents.

Fifth day 16 cents.

And so on...
__________________
System: $775
CPU
Phenom II 720
Motherboard
Gigabyte MA790X-UD4P
Memory
4GB OCZ Reaper DDR2 1150
Hard Drive
250GB Seagate Barracuda 7200.10 x 2
Power Supply
PC Power & Cooling 610W
Case
Antec 300
CPU cooling
XIGMATEK Dark Knight-S1283V
OS
Vista 64-bit
godsgift2dagame is offline   Reply With Quote
Old 09-27-09   #5 (permalink)
PC Gamer
 
Nhb93's Avatar
 
amd nvidia

Join Date: Aug 2009
Posts: 313

Rep: 18 Nhb93 Unknown
Unique Rep: 17
Trader Rating: 0
Default

The "x *= 2" way. I assume you know, but in case you don't *= is short hand for x = x * 2. It's just a way of saving time.

for (int i = 0; x > 30; x++)
{
x *= 2
}

That's for Java at least.

System: HAFaestus (Alienware ported into HAF 932)
CPU
AMD Athlon 64 X2 6000+
Motherboard
Foxconn nForce 590 SLI
Memory
4GB
Graphics Card
GeForce 8800 GTX
Hard Drive
250GB Seagate + 750GB WD
Sound Card
Onboard
Power Supply
HIPRO HP-W700WC3 LF 700W
Case
Cooler Master HAF 932
CPU cooling
TRUE + Ceramique + San Ace 120
GPU cooling
Stock
OS
Windows 7 Professional 64-bit/Windows XP 32-bit
Monitor
Samsung SyncMaster 930B

Last edited by Nhb93 : 09-27-09 at 08:17 PM
Nhb93 is offline   Reply With Quote
Old 09-27-09   #6 (permalink)
AMD Overclocker
 
amd nvidia

Join Date: Apr 2009
Posts: 433

Rep: 19 godsgift2dagame Unknown
Unique Rep: 17
Trader Rating: 0
Default

And how would I get the sum of this then?

EDIT: Yes, I knew about the x *= 2. I was just commenting in regards to trying to explain myself better for ya'll.

Thanks man!
__________________
System: $775
CPU
Phenom II 720
Motherboard
Gigabyte MA790X-UD4P
Memory
4GB OCZ Reaper DDR2 1150
Hard Drive
250GB Seagate Barracuda 7200.10 x 2
Power Supply
PC Power & Cooling 610W
Case
Antec 300
CPU cooling
XIGMATEK Dark Knight-S1283V
OS
Vista 64-bit
godsgift2dagame is offline   Reply With Quote
Old 09-27-09   #7 (permalink)
PC Gamer
 
Nhb93's Avatar
 
amd nvidia

Join Date: Aug 2009
Posts: 313

Rep: 18 Nhb93 Unknown
Unique Rep: 17
Trader Rating: 0
Default

To get the final result? Just call x for calculations, or print out x to view the number.

System: HAFaestus (Alienware ported into HAF 932)
CPU
AMD Athlon 64 X2 6000+
Motherboard
Foxconn nForce 590 SLI
Memory
4GB
Graphics Card
GeForce 8800 GTX
Hard Drive
250GB Seagate + 750GB WD
Sound Card
Onboard
Power Supply
HIPRO HP-W700WC3 LF 700W
Case
Cooler Master HAF 932
CPU cooling
TRUE + Ceramique + San Ace 120
GPU cooling
Stock
OS
Windows 7 Professional 64-bit/Windows XP 32-bit
Monitor
Samsung SyncMaster 930B
Nhb93 is offline   Reply With Quote
Old 09-27-09   #8 (permalink)
4.0 GHz
 
MeeksMan13's Avatar
 
intel nvidia

Join Date: Dec 2008
Location: Dripping Springs/Denton
Posts: 890

Rep: 46 MeeksMan13 is acknowledged by some
Unique Rep: 44
Trader Rating: 1
Default

are you talking about getting the sum of all the values of x?

if so, in the loop, you would do "y+=x"
__________________
I'm a junior in college, Comp Sci major/math minor, if you wanna talk, send me a pm

The *OFFICIAL* HAF 932 Case Owners Club My HAF 932 Paint Job

Water Cooling (own red, need black)
Click below to show/hide Hidden Text Below!

Apogee XT
TFC XChanger 360
Inverse T-Virus
1/2" Black Barbs
10' 7/16" Tygon
EK D5 Pump Top

Swiftech MCP655 Vario
Need: $100


Quote:
Once I went out and got drunk. then came home and thought it would be a good idea to overclock enough join the 100% overclockers club. Lesson learned: you CAN'T get to 6 GHz when you're hammered.-pfritzmorkin

System: The Factory
CPU
E8500 @ 4.25 gHz
Motherboard
EVGA 780i FTW
Memory
Patriot Viper 2 x 2 GB PC 8500
Graphics Card
2x GTX 260
Hard Drive
Samsung 750GB 7200 RPM; 300 GB Seagate
Sound Card
Creative X-Fi Platinum w/ FD Bay
Power Supply
OCZ 700w Fatal1ty Edition
Case
HAF 932 (Painted)
CPU cooling
Hyper Z600R (Apogee XT soon)
GPU cooling
Stock
OS
Windows 7 64 bit
Monitor
Acer 22" X223W
MeeksMan13 is offline   Reply With Quote
Old 09-27-09   #9 (permalink)
Overclocker in Training
 
rmvvwls's Avatar
 
intel ati

Join Date: Aug 2008
Location: NSW, Australia
Posts: 535

Rep: 59 rmvvwls is acknowledged by some
Unique Rep: 47
Trader Rating: 1
Default

Quote:
Originally Posted by MeeksMan13 View Post
are you talking about getting the sum of all the values of x?

if so, in the loop, you would do "y+=x"
Yes, but more complex than just calling x or printing it.

System: Bradsbomp
CPU
Intel e7200 2.53GHz @ 3.8GHz (400 x 9.5, 1.36V)
Motherboard
Gigabyte GA-EP45-UD3P
Memory
4 GB OCZ 800MHz (4-4-4-12)
Graphics Card
Sapphire 4870x2
Hard Drive
WD320+Samsung 160&500
Sound Card
Onboard
Power Supply
Corsair TX650W
Case
Thermaltake Armor+ MX w/ Custom Paintjob
CPU cooling
Zalman CNPS9700LED
GPU cooling
Stock
OS
Windows 7 RC (7100)
Monitor
TH32LZD800A + E2200HD
rmvvwls is online now rmvvwls's Gallery   Reply With Quote
Old 09-27-09   #10 (permalink)
4.0 GHz
 
MeeksMan13's Avatar
 
intel nvidia

Join Date: Dec 2008
Location: Dripping Springs/Denton
Posts: 890

Rep: 46 MeeksMan13 is acknowledged by some
Unique Rep: 44
Trader Rating: 1
Default

Quote:
Originally Posted by rmvvwls View Post
Yes, but more complex than just calling x or printing it.
explain please
__________________
I'm a junior in college, Comp Sci major/math minor, if you wanna talk, send me a pm

The *OFFICIAL* HAF 932 Case Owners Club My HAF 932 Paint Job

Water Cooling (own red, need black)
Click below to show/hide Hidden Text Below!

Apogee XT
TFC XChanger 360
Inverse T-Virus
1/2" Black Barbs
10' 7/16" Tygon
EK D5 Pump Top

Swiftech MCP655 Vario
Need: $100


Quote:
Once I went out and got drunk. then came home and thought it would be a good idea to overclock enough join the 100% overclockers club. Lesson learned: you CAN'T get to 6 GHz when you're hammered.-pfritzmorkin

System: The Factory
CPU
E8500 @ 4.25 gHz
Motherboard
EVGA 780i FTW
Memory
Patriot Viper 2 x 2 GB PC 8500
Graphics Card
2x GTX 260
Hard Drive
Samsung 750GB 7200 RPM; 300 GB Seagate
Sound Card
Creative X-Fi Platinum w/ FD Bay
Power Supply
OCZ 700w Fatal1ty Edition
Case
HAF 932 (Painted)
CPU cooling
Hyper Z600R (Apogee XT soon)
GPU cooling
Stock
OS
Windows 7 64 bit
Monitor
Acer 22" X223W
MeeksMan13 is offline   Reply With Quote
Reply


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



All times are GMT -5. The time now is 07:59 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License

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