Character code

This is a discussion on Character code within the C Programming forums, part of the General Programming Boards category; I'm suppose to write a user friendly programme using functions and modules to accept six names from a user and ...

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    1

    Character code

    I'm suppose to write a user friendly programme using functions and modules to accept six names from a user and print to the screen the six names then ask the user which name they want deleted then print the remaining names after the name is deleted then notify the user which name was deleted.
    This is what i have come up with thus far.

    printf("Which name would you like deleted?\n");
    scanf("%s",&pie);

    for(char egg=0; egg<=5; egg++)
    {
    if (myarray[egg]!=pie)
    {
    printf("%s",myarray[egg]);
    printf(" ");
    }
    }
    return 0;
    }

    and i have also tried this as well
    #include <stdio.h>

    void getnames()
    {
    printf("Enter six names \n");
    for(int i=0;i<=5;i++)
    {
    scanf("%s",nameArr[i]);
    }
    }
    void display()
    {
    for (int j=0;j< name;j++)
    {
    printf("\n %s ",nameArr[j]);
    printf("\n");
    }
    }

    void main()
    {
    getnames();
    display();
    printf("What do you want to delete");
    remove();
    display();
    }

    void remove()
    {

    printf("\nPlease Enter the name you want to deleted");
    scanf_s("%d",&val);
    for(int mad=0;mad<=5;mad++)
    {
    if(temp[mad]==val)
    {
    temp[mad]=val;

    }
    else
    {

    printf("%d",temp[mad]);
    printf(" ");

    }
    }



    return 0;
    }
    [/CODE]
    Last edited by sally2009; 03-06-2008 at 02:42 PM.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,918
    Neither void main nor char main is standard; use int main to begin with.
    Then I suggest you go back and re-learn how to read strings, because you certainly do not read them into int arrays.
    And read my signature about reading strings with scanf or use fgets.

    And then select all your code and press Alt+F8 to indent it. You've made a mistake in a loop, as well.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  2. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  3. covert ascii code to character
    By Shadow in forum C Programming
    Replies: 2
    Last Post: 04-25-2002, 10:53 PM
  4. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 12:51 PM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21