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-30-09   #1 (permalink)
Halo > Half Life
 
Fatal05's Avatar
 
intel nvidia

Join Date: Feb 2006
Location: San Luis Obispo, CA
Posts: 3,879

Rep: 321 Fatal05 is a proven memberFatal05 is a proven memberFatal05 is a proven memberFatal05 is a proven member
Unique Rep: 232
Hardware Reviews: 1
Trader Rating: 9
Default C Programming Noob

Hey guys, I'm trying to figure out this comp sci assignment and I was wondering if you could point me in the right direction. Maybe some helpful websites. I have ZERO programming experience, and had to self teach myself to navigate through unix directories.

Our professor is the hardest CSC instructor at the University, and he expects us to teach ourselves. The text book is very convoluted, and is probably the biggest waste of $100 I've ever made. And this is our first assignment :/

Here's the problem, so you'll at least know where to point me.

Write a program that prompts for two integers, and checks for the following cases:

1) Integers are equal.

2) First integer is at least twice the second one, perhaps even larger.

3) The integers differ by at least 10.

Use separate if-statements for each case. You may find you need two if-statements for case 3). For any case that is true, print the message given above for that case. Note that it's possible for both 2) and 3) to be true, and even for both 1) and 2) to be true, if you think carefully about all possible integer values.

Run your program repeatedly, with input that produces each of these outcomes:

None of the cases are true.

Only case 1) is true

Only case 2) is true

Only case 3) is true

Case 1) and 3) are true

Case 2) and 3) are true
__________________
System: Peace and Quiet
CPU
E6300 B2 2.8ghz [1.33v]
Motherboard
DFI Blood Iron P35-T2RL
Memory
[2x2GB] OCZ SLI DDR2 800
Graphics Card
eVGA 8800GT SC 512MB
Hard Drive
Seagate 250GB 7200.10
Sound Card
Creative Audigy 4
Power Supply
FSP Blue Storm II 500W
Case
Antec Solo
CPU cooling
AC Freezer 7 Pro
GPU cooling
Stock
OS
Windows 7 7600 x64
Monitor
Westinghouse 19" [1680/1050]
Fatal05 is offline Overclocked Account Fatal05's Gallery   Reply With Quote
Old 10-01-09   #2 (permalink)
Programmer
 
lordikon's Avatar
 
intel nvidia

Join Date: Feb 2008
Location: Denver, CO
Posts: 3,916

Rep: 189 lordikon is acknowledged by manylordikon is acknowledged by many
Unique Rep: 151
Folding Team Rank: 104
Trader Rating: 0
Default

I would recommend looking for some free online tutorials for C, this is really basic stuff, I don't even know how I could go into any detail with giving an answer. Lemme give it a shot:

1.) Create two integers, use an 'if' statement to check equality. Equality uses the '==' operator.

2.) You could probably multiply the first integer by two, and then check if it is greater than the second.

3.) First minus the second is greater than zero?

I'm not exactly sure what the second half of your question means. It looks like you need to be able to choose the first and second integer through input, and test different combinations of numbers to give the results they're looking for.
__________________
Current Modern Warfare 2 petition count: http://sebastien.me/mw2/petition.png
Currently folding with:
2 8800GTS g92s -- 1 GTX 275 -- 1 8600GTS -- 1 e8400 -- 1 i7 950 (50%) -- 1 e6600

System: Max Pwnage
CPU
e8400 E0, 3.81Ghz, 1.324v
Motherboard
Asus P5N-D 750i
Memory
4GB (2x2gb) A-Data DDR2-800
Graphics Card
2x 8800GTS 512(G92) SLI
Hard Drive
150 WD Raptor, 640 WD Ext.
Power Supply
750W PC P&C Silencer
Case
CoolerMaster 690
CPU cooling
$7USD Copper HS
GPU cooling
Stock
OS
Vista Home Premium
Monitor
22" Asus AL2223W
1 Million+ Folding at Home points
lordikon is offline I fold for Overclock.net   Reply With Quote
Old 10-01-09   #3 (permalink)
Halo > Half Life
 
Fatal05's Avatar
 
intel nvidia

Join Date: Feb 2006
Location: San Luis Obispo, CA
Posts: 3,879

Rep: 321 Fatal05 is a proven memberFatal05 is a proven memberFatal05 is a proven memberFatal05 is a proven member
Unique Rep: 232
Hardware Reviews: 1
Trader Rating: 9
Default

Would you recommend C for Dummies? lol
__________________
System: Peace and Quiet
CPU
E6300 B2 2.8ghz [1.33v]
Motherboard
DFI Blood Iron P35-T2RL
Memory
[2x2GB] OCZ SLI DDR2 800
Graphics Card
eVGA 8800GT SC 512MB
Hard Drive
Seagate 250GB 7200.10
Sound Card
Creative Audigy 4
Power Supply
FSP Blue Storm II 500W
Case
Antec Solo
CPU cooling
AC Freezer 7 Pro
GPU cooling
Stock
OS
Windows 7 7600 x64
Monitor
Westinghouse 19" [1680/1050]
Fatal05 is offline Overclocked Account Fatal05's Gallery   Reply With Quote
Old 10-01-09   #4 (permalink)
Programmer
 
lordikon's Avatar
 
intel nvidia

Join Date: Feb 2008
Location: Denver, CO
Posts: 3,916

Rep: 189 lordikon is acknowledged by manylordikon is acknowledged by many
Unique Rep: 151
Folding Team Rank: 104
Trader Rating: 0
Default

Quote:
Originally Posted by Fatal05 View Post
Would you recommend C for Dummies? lol
For something this simple almost any beginner's C book would cover it. My first book was a C++ book, C++ just happens to be built upon C, so I know enough C to get by.

'C by example', maybe? If there is a 'C for Dummies', that might work. It really depends how much programming you're really going to need to know in the future, if it is a lot, then buy a really good book that will cover more than just the basics.
__________________
Current Modern Warfare 2 petition count: http://sebastien.me/mw2/petition.png
Currently folding with:
2 8800GTS g92s -- 1 GTX 275 -- 1 8600GTS -- 1 e8400 -- 1 i7 950 (50%) -- 1 e6600

System: Max Pwnage
CPU
e8400 E0, 3.81Ghz, 1.324v
Motherboard
Asus P5N-D 750i
Memory
4GB (2x2gb) A-Data DDR2-800
Graphics Card
2x 8800GTS 512(G92) SLI
Hard Drive
150 WD Raptor, 640 WD Ext.
Power Supply
750W PC P&C Silencer
Case
CoolerMaster 690
CPU cooling
$7USD Copper HS
GPU cooling
Stock
OS
Vista Home Premium
Monitor
22" Asus AL2223W
1 Million+ Folding at Home points
lordikon is offline I fold for Overclock.net   Reply With Quote
Old 10-01-09   #5 (permalink)
Graphics Card Aficionado
 
Drift0r's Avatar
 
intel nvidia

Join Date: Sep 2008
Location: Cali :P
Posts: 1,433

Rep: 82 Drift0r is acknowledged by some
Unique Rep: 77
Hardware Reviews: 1
Trader Rating: 1
Default

Use "if - then" statements. This will allow you to check if any of the cases are true or not, and return these back to the user. Simple, get input from user, check if any cases are true, then return back to user. I don't know if I'm much help since I was taught C++. Looking back, this is very basic stuff, almost the basis of programming.
__________________
Quote:
Originally Posted by Tator Tot View Post
I've been pissing blue for years, is this a problem?
Steam/TF2 Name: [OCN]Rubbish

System: The Blue Aroourourourourua
CPU
Core 2 Duo E7200 @ 3.6GHz
Motherboard
Asus P5E-VM HDMI
Memory
OCZ Platinum Rev.2 PC6400 4GB
Graphics Card
EVGA 9800GT 512MB
Hard Drive
Seagate 500GB SATA 7200RPM
Sound Card
Integrated Realtek HD Audio
Power Supply
Thermaltake Purepower 430W
Case
CoolerMaster Elite 340 mATX
CPU cooling
Xigmatek Dark Knight S1283V
OS
Windows XP Pro SP2 and Vista Ultimate x64
Monitor
Acer X193W+
Drift0r is online now   Reply With Quote
Old 10-01-09   #6 (permalink)
Security Sleuth
 
Pooping^fish's Avatar
 
intel nvidia

Join Date: Jul 2007
Location: egypt
Posts: 1,267

Rep: 67 Pooping^fish is acknowledged by some
Unique Rep: 62
Trader Rating: 3
Default

More homework which wont be done for you!

Its obvious you havnt attempted to read the book or google for tutorials. As mentioned this is very basic, and looking over a few tutorials will gladly get you on your way.

If you have problems with your code, then come back to us so we can assist you.
__________________
Quote:
"O, hai! Want som pRon? Dwnlod ths kodk frst. Its teh bst pRonz ever, we prmis." -GibbyGano
Proud Member of the Linux Gaming Community
I am your friend.

System: ragequit
CPU
Q9550 4ghz @ 1.25v
Motherboard
Asus Max 2 formula
Memory
OCZ LV blade 1:1 950mhz
Graphics Card
8800gtx 610/1ghz
Hard Drive
7200.10 250gb
Sound Card
X-FI Extreme Music
Power Supply
750w Toughpower
Case
Lian li pc-65
CPU cooling
TRUE
GPU cooling
stock
OS
leetlinucks
Monitor
24" Westy
Pooping^fish is offline   Reply With Quote
Old 10-01-09   #7 (permalink)
Overclocker
 
Atomagenesis's Avatar
 
amd ati

Join Date: May 2008
Location: Empire State of the South
Posts: 970

Rep: 50 Atomagenesis is acknowledged by some
Unique Rep: 41
Trader Rating: 0
Default

Complaining about the book isn't going to help you get the assignments done. Try to keep a positive attitude.
__________________
System: That Which Is v2.0
CPU
Phenom 955
Motherboard
GA-MA770T-UD3P
Memory
2x2gb Patriot DDR3 1600 7-7-7-20
Graphics Card
XFX 4890
Hard Drive
500gb Seagate 7200.12
Sound Card
Musiland 02 US AMP/DAC
Power Supply
OCZ 700w GameXStream
Case
Chieftec Dragon Full Tower
OS
Windows 7 x64 RTM
Monitor
SAMSUNG 2343BWX 23" 2048x1152
Atomagenesis is offline   Reply With Quote
Old 10-01-09   #8 (permalink)
WaterCooler
 
wimcle's Avatar
 
intel nvidia

Join Date: Jan 2009
Location: Shawnee,KS
Posts: 304

Rep: 38 wimcle is acknowledged by some
Unique Rep: 35
Trader Rating: 1
Default

there is only one C programming book:


thou shalt hold no others before it!
__________________
System: water damage
CPU
920 4.1 21x195
Motherboard
Gigabyte ex58-ds4
Memory
6+3G OCZ gold ddr3 1600 c7
Graphics Card
BFG gtx280
Hard Drive
wd6401aals x6
Power Supply
Corsair tx650w
Case
CM 590
CPU cooling
Dangerden MC-TDX
GPU cooling
XSPC razor
OS
XP
Monitor
Samsung 2343bwx
wimcle 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 11:28 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.14833 seconds with 8 queries