|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
C Programming Noob
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||||
|
Halo > Half Life
![]() |
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
|
|||||||||||||
|
|
|
|
#2 (permalink) | ||||||||||||
|
Programmer
![]() |
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
|
||||||||||||
|
|
|
|
|
#3 (permalink) | |||||||||||||
|
Halo > Half Life
![]() |
Would you recommend C for Dummies? lol
__________________
|
|||||||||||||
|
|
|
|
#4 (permalink) | ||||||||||||
|
Programmer
![]() |
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
|
||||||||||||
|
|
|
|
|
#5 (permalink) | ||||||||||||
|
Graphics Card Aficionado
![]() |
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.
__________________
Steam/TF2 Name: [OCN]Rubbish
|
||||||||||||
|
|
|
|
|
#6 (permalink) | ||||||||||||||
|
Security Sleuth
![]() |
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:
Proud Member of the Linux Gaming CommunityI am your friend.
|
||||||||||||||
|
|
|
|
|
#7 (permalink) | |||||||||||
|
Overclocker
![]()
Join Date: May 2008
Location: Empire State of the South
Posts: 970
Rep: 50
![]() Unique Rep: 41
Trader Rating: 0
|
Complaining about the book isn't going to help you get the assignments done. Try to keep a positive attitude.
__________________
|
|||||||||||
|
|
|
|
|
#8 (permalink) | ||||||||||||
|
WaterCooler
![]() |
there is only one C programming book:
__________________![]() thou shalt hold no others before it!
|
||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|