Thread: need c programming code for the following specifications

  1. #1
    Registered User
    Join Date
    Nov 2014
    Posts
    1

    need c programming code for the following specifications

    Guess My Number (High-Low) Two Players Take Their Turn

    Create a program that will simulate the child's number guessing game with two players who will play against the computer. The program should have the following requirements:
    1. When the program is invoked the computer will pseudorandomly choose which player will go first.
    2. Play begins when the computer interface asks "Player Number". A player number (either 1 or 2) is entered from the keyboard. If a player enters their number at the keyboard and it is not their turn the computer will report back "You have to wait your turn" and return to the query "Player Number". If it is a player's turn the computer will query "Enter Your Guess". The player may either enter a guess or indicate a desire to pass the play to the other player by entering the word PASS at the prompt. If the player enters a guess the computer will report back that the guess is too high, too low or correct and return to the query "Player Number" and pass play to the other player.
    3. No player may pass two turns in a row, and cannot exceed more than three passes for the entire game. If the player chooses to pass the computer should report "You have passed X number of times, you have Y more times left" before returning the query "Player Number".
    4. The play progresses until one user provides a correct guess.
    5. The program must be written in C and must be able to be compiled and run on UISACAD (no exceptions) using the gcc compiler (do not use g++).

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,663
    Announcements - C++ Programming
    Announcements - General Programming Boards
    And finally
    Announcements - C++ Programming

    We're not a homework factory.

    If you make a real effort, then you'll get real help.

    We're not interested in homework copy/paste bots.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    ...So if it's C, why post in C++? Makes no sense.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Rat with a C++ compiler Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    203
    If he can't even tell the difference between the languages, I can't wait to see his final grade in the class.
    How to ask smart questions
    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesOverwritten);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File path specifications
    By Shingetsu Kurai in forum C# Programming
    Replies: 6
    Last Post: 09-20-2011, 05:56 AM
  2. Exception specifications: throw() useful?
    By Memloop in forum C++ Programming
    Replies: 7
    Last Post: 11-25-2009, 02:24 AM
  3. XML Family of Specifications, by Kenneth B. Sall
    By neandrake in forum Programming Book and Product Reviews
    Replies: 0
    Last Post: 04-23-2009, 05:41 PM
  4. Obtaining System Specifications Through C++
    By SiLeNt BoB in forum C++ Programming
    Replies: 4
    Last Post: 06-06-2003, 08:40 AM
  5. Exception specifications: good or bad?
    By Just in forum C++ Programming
    Replies: 0
    Last Post: 02-19-2003, 09:19 PM