Thread: Urgent: Need help

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    11

    Urgent: Need help

    Hello,

    I have an assignment to make a program which take values in an array then ask the user to delete a particular value.

    so far I have made this
    Code:
    #include <stdio.h>
    #include <conio.h>
    void main(void)
    {
    clrscr();
    int ab[6],a,b;
    for (a=0;a<=5;a++)
    {
    printf ("\nEnter value: ");
    scanf  ("%d",&ab[a]);
    }
    printf ("Enter the value you wish to delete: ");
    scanf  ("%d",&b);
    if (b==ab[a]
     {
    what next i should do that it will delete that particular value and print the rest.

    waiting impatiently for reply.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    URGENT: Need to READ THE FORUM GUIDELINES!


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    11
    Well I'm asking only for a hint that how could I delete that particular value, not the entire code so that.

    Just a lil help will do it. I guess, I'm not asking for anything big.

    Waiting for reply.

  4. #4
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Well, what do you mean by "delete"? Set to -1? Completely remove from array? Crash into remote Arizona? The solution depends on what you want to do.

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    43
    If all you need to do is print the array there is no need to actually modify any of the values in the array. Just use a for loop to cycle through each value in the array, and if it is not equal to be print it, otherwise don't do anything and the loop will skip that value.
    If you need to do more than just print the array, you will probably have to write some code that will shift every value in the array one place to the left.

    Hope this helps
    Crazed

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Code:
    #include <stdio.h>
    #include <conio.h> /*Non-standard header file/* 
    void main(void) */main returns int/*
    {
    clrscr(); /*Non-standard function/*
    int ab[6],a,b;
    for (a=0;a<=5;a++)
    {
    printf ("\nEnter value: ");
    scanf  ("%d",&ab[a]);
    }
    printf ("Enter the value you wish to delete: ");
    scanf  ("%d",&b);
    if (b==ab[a]
     {

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. display character size...(quite urgent..)
    By karthi in forum C Programming
    Replies: 10
    Last Post: 07-11-2007, 09:42 PM
  2. beginner plzz help urgent
    By sara101 in forum C Programming
    Replies: 11
    Last Post: 01-14-2007, 10:38 PM
  3. Linked List Need Help Urgent
    By ykchua in forum C Programming
    Replies: 5
    Last Post: 08-17-2004, 02:57 PM