collapse collapse

* Recent News

* Recent Posts

Fifth Matrix Film Announced! by Lithium
[April 07, 2024, 09:49:37 pm]


2024: New PC for VR! by Tbone
[April 06, 2024, 12:22:30 pm]


MOVED: Fifth Matrix Film Announced! by Tbone
[April 06, 2024, 12:18:27 pm]


Holiday Fun by Tbone
[March 01, 2024, 09:09:44 pm]


Quest 2 Link Best Settings (Finally Better Than Rift S) by Tbone
[November 27, 2023, 04:57:46 pm]


randomness by Jeyk
[November 27, 2023, 09:42:30 am]


New PC for Oculus Rift (Purchased!) by Tbone
[December 01, 2022, 12:02:55 pm]


Stability Issues with CPU/RAM/Mobo by Tbone
[November 30, 2022, 12:34:56 pm]

Author Topic: C Assignment help  (Read 2029 times)

Offline Avzeke (Khr0n1k)

  • VETERAN ANGEL
  • *******
  • Join Date: Feb 2005
  • Posts: 1912
    • View Profile
C Assignment help
« on: March 27, 2008, 12:02:00 am »
Do any you guys know C? I have this extra credit assignment that is supposed to be hard, for us, and I really need to do it so I can make sure I get an A this semester. It is a programming 1 class so nothing really advanced if any of you guys can help. This is the assignment paper.

Quote
Computer Programming I
Extra Credit Assignment
20 points (ALL or NOTHING)
Write a program that will allow the user to play a guessing game with the computer. The
program should present the user with two options:
1. Computer thinks of number, user guesses
2. User thinks of number, computer guesses
The number should be an integer between 1 and 100.
Option 1:
When the computer "thinks" of a number, it will generate a random number between 1 and
100 and then ask the user to guess. While the user's guess is not accurate, a message of
"Too high" or "Too low" will be displayed followed by a prompt for another guess. Once the
guess is correct, a message will be displayed indicating the correct guess and the fact that
the user has won. Option 2:
User enters the a number. The computer will use the following strategy to guess the
number:
a. Start with a guess in the middle (ie 50)
b. While guess is not correct
i. If guess is too high, guess the number half way between current guess and the
highest "low" guess made so far.
ii. If guess is too low, guess the number half way between current guess and the
lowest "high" guess made so far.
c. Once the guess is accurate, a message will be displayed indicating the correct guess


If you guys could give some help I would appreciate it greatly!


Topherous Jedi Sentinel
Artifice, Archaeology, Treasure Hunting

Offline Eroz

  • VETERAN ANGEL
  • *******
  • Join Date: May 2004
  • Posts: 2015
    • View Profile
Re: C Assignment help
« Reply #1 on: March 27, 2008, 12:27:59 am »
Seriously, Yea I can for sure help with this. I just finish coding my own shell in C. When is it due by?
"Have you ever tried to dismantle a snowball?" - Linus, Peanut's Gang.

Offline Avzeke (Khr0n1k)

  • VETERAN ANGEL
  • *******
  • Join Date: Feb 2005
  • Posts: 1912
    • View Profile
Re: C Assignment help
« Reply #2 on: March 27, 2008, 01:07:19 am »
Wednesday, which is the 2nd of April I believe. Thanks Eroz!


Topherous Jedi Sentinel
Artifice, Archaeology, Treasure Hunting

Offline Eroz

  • VETERAN ANGEL
  • *******
  • Join Date: May 2004
  • Posts: 2015
    • View Profile
Re: C Assignment help
« Reply #3 on: March 27, 2008, 02:56:37 am »
So I just sat down and coded it out.  Took me about an 1 to do it, assuming its console and POSIX C based. I would say this is my best coded program, then again its one of the shortest ones too. Hooray Switch/Case. So any time just send an IM to EBiohazard and I can try and help.

Some key C functions to use.

fgets and atoi
rand (Be sure to use srand while using rand or you'll always get the same number.)
(int) (X) (to convert a floor back into a int.)

You only need stdio.h and stdlib.h too.

This would have been so much easier in Python.
"Have you ever tried to dismantle a snowball?" - Linus, Peanut's Gang.

Offline NoCry

  • Staff
  • *******
  • Join Date: Mar 2006
  • Posts: 2617
    • View Profile
Re: C Assignment help
« Reply #4 on: March 27, 2008, 06:35:07 am »
*nocry faints

Offline Pirus

  • VETERAN ANGEL
  • *******
  • Join Date: Mar 2006
  • Posts: 1728
    • View Profile
Re: C Assignment help
« Reply #5 on: March 27, 2008, 06:37:11 am »
*yells for broin to quickly administer mouth to mouth as I surely wont do it. :)*


too bad this isn't visual or q basic I know those 2 much better than I know C

 

 

* Discord

Calendar

May 2024
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4
5 6 7 8 9 10 11
[12] 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

No calendar events were found.

* Who's Online

  • Dot Guests: 273
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

Social