Thread: C Programming Homework

  1. #1
    Registered User
    Join Date
    Mar 2019

    C Programming Homework

    Hello friends.
    I have a C programming assignment and I have very little time left.
    I need to write this function.
    I'd be very happy if you could help.
    Note: It is forbidden to use <string.h>.

    Write a function that takes name, type, attack range, attack power and stamina
    specifications of the all Pokémons built a Pokedex. The function takes the name of the Pokémon that is
    queried by the user (inside the function) and show the specifications of the Pokémon if it is in the Pokedex
    database. Pokémons and attack types of Pokémons must be an enumerated type. You can find professor
    Oak’s Pokedex information in Pokedex.xls file (you should not try to read information of the Pokémons
    from the file programmatically, just read the file to prepare your arrays and enums manually). The function prototype is:
    void pokedex(char *Pokemon_name[], int range[], attack_type type[],
    int attack_power[], int stamina[]);

    Example run on the function:


    Please type name of the Pokémon (type exit to close Pokedex):

    Name: Pikachu
    A. Type : Linear
    Range: 3 block
    A. Power : 105
    Stamina : 500

    C Programming Homework-screenshot-2019-03-21-19-55-16-png

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    What help do you need?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Mar 2019
    Quote Originally Posted by laserlight View Post
    What help do you need?

    I can't do my homework. I actually did the general part. But I don't know how to compare strings without string.h.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    So write your own strcmp.
    It's only a few lines of code.

    int mystrcmp( const char *left, const char *right ) {
      // use a loop to compare left[i] with right[i]
    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.

  5. #5
    TEIAM - problem solved
    Join Date
    Apr 2012
    Melbourne Australia
    Maybe it will help realising that a string is a char array that can be looped through using a 'for' loop

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Programming University Homework
    By rezervi1 in forum C Programming
    Replies: 7
    Last Post: 04-08-2018, 08:57 AM
  2. C programming homework
    By jonathan123456 in forum C Programming
    Replies: 2
    Last Post: 11-09-2017, 03:00 PM
  3. C Programming homework help needed
    By bowmanx4587 in forum C Programming
    Replies: 1
    Last Post: 12-06-2015, 09:34 PM
  4. new to c programming, Homework help
    By esardinha08 in forum C Programming
    Replies: 10
    Last Post: 01-01-2012, 10:42 PM
  5. What should be the Homework for game Programming?
    By mistu4u in forum Game Programming
    Replies: 7
    Last Post: 06-16-2011, 12:36 AM

Tags for this Thread