Need codes/idea in Turbo C

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MabZiCLe
    New Member
    • Nov 2006
    • 7

    Need codes/idea in Turbo C

    Hi .... i have a problem...

    i need to know how to make this program, using arrays only, maybe no function calls . also it must be in line code.


    well, this is the program.
    Create a program,,,that store , name, prize , barcode of an item.
    It can add, view, search and delete item.

    Items are only 10 elements:Barcod e is auto-increment.

    sample:

    Barcode: Name prize:
    1.10000 calculus $100
    2.10001
    3
    .
    .
    .
    .
    .10. blah blah..

    The user will choose:
    [A]dd item
    [V]iew items
    [S]earch item
    [D]elete item
    [Q]uit.


    in Add item:

    Name:
    Prize:

    that will stored.

    View items:*it will view all 10 items:

    Search:

    Search: name

    Delete item:

    Delete what number:

    Quit: quits the program..




    Hope you can help me ....
    thanks and more power...!
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Originally posted by MabZiCLe
    Hi .... i have a problem...

    i need to know how to make this program, using arrays only, maybe no function calls . also it must be in line code.


    well, this is the program.
    Create a program,,,that store , name, prize , barcode of an item.
    It can add, view, search and delete item.

    Items are only 10 elements:Barcod e is auto-increment.

    sample:

    Barcode: Name prize:
    1.10000 calculus $100
    2.10001
    3
    .
    .
    .
    .
    .10. blah blah..

    The user will choose:
    [A]dd item
    [V]iew items
    [S]earch item
    [D]elete item
    [Q]uit.


    in Add item:

    Name:
    Prize:

    that will stored.

    View items:*it will view all 10 items:

    Search:

    Search: name

    Delete item:

    Delete what number:

    Quit: quits the program..




    Hope you can help me ....
    thanks and more power...!
    Hi. What have you done with it so far?

    Comment

    • MabZiCLe
      New Member
      • Nov 2006
      • 7

      #3
      Not yet exactly, well, i really need a sample codes..

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by MabZiCLe
        Not yet exactly, well, i really need a sample codes..
        You need to read about struct and arrays then attempt it and post whatever code you'll have written.

        Comment

        • MabZiCLe
          New Member
          • Nov 2006
          • 7

          #5
          #include <stdio.h>

          main(){
          int
          char choose;
          printf("Choose" );
          printf("[A]dd item \n")
          printf("[V]iew item \n")
          printf("[S]earch item \n")
          printf("[D]elete item \n")
          printf("[Q]uit \n")
          scanf(" %c", &choose);
          choose=toupper( choose);
          switch(choose){
          case 'A':
          no code yet:
          break;
          case 'V':
          no code yet:
          break;
          case 'S':
          no code yet:
          break
          case 'D':
          no code yet:
          break;
          case 'Q':
          Quits the program
          break;
          default:
          printf("invalid selection");
          break;
          }


          thats it i really need the add item view and quit ..=(

          Comment

          • shardul316
            New Member
            • Jan 2007
            • 20

            #6
            Originally posted by MabZiCLe
            #include <stdio.h>

            main(){
            int
            char choose;
            printf("Choose" );
            printf("[A]dd item \n")
            printf("[V]iew item \n")
            printf("[S]earch item \n")
            printf("[D]elete item \n")
            printf("[Q]uit \n")
            scanf(" %c", &choose);
            choose=toupper( choose);
            switch(choose){
            case 'A':
            no code yet:
            break;
            case 'V':
            no code yet:
            break;
            case 'S':
            no code yet:
            break
            case 'D':
            no code yet:
            break;
            case 'Q':
            Quits the program
            break;
            default:
            printf("invalid selection");
            break;
            }


            thats it i really need the add item view and quit ..=(
            in order to add element to the array you should declare the array of size greater than 10.if you have array of size 10 and still you want to add 11....n elements
            it is not possible .
            if you declare array of size 10 or more then it is possible
            as you mentioned array element will store name and prize both.
            it is not possible for one dimentional array to hold both prize,name .
            for that you should use multidimentiona l array.and if you want that array
            element should store name,number,pri ze.....
            then simultaneously you have to increase the dimensions of array.
            according to me you can't delete array element but u can reinitialize it.
            you can quit the program by using
            switch(choose)
            { .
            .
            .
            case 'Q':
            exit();
            }
            but instead of using case Q as exit ,it is better for u to use default case
            for quitting the program by using exit.
            with the increase in dimentions of array program becomes complicated
            instead of this pgm will become easier by the use of structure.
            by using struture of arrays.

            Comment

            • khajeddin
              New Member
              • Nov 2006
              • 51

              #7
              hi:
              to make an Array that have all you want, to take from apllicator,you have to study Structures.then you can make an Array that in every elemen you can have :name,prize,dat e of buy,code bar,...and so on simoltaneously.
              so search : tutorial+C programming +struct

              Comment

              • Ganon11
                Recognized Expert Specialist
                • Oct 2006
                • 3651

                #8
                The above post was deleted because the poster gave the full code with no explanation, no quidance - simply the answer. TSDN does not support this, as it is flat-out cheating, and a large number of posts here are from university students. Please read this thread for a full explanation of our policy in this regard.

                Comment

                • shardul316
                  New Member
                  • Jan 2007
                  • 20

                  #9
                  Originally posted by Ganon11
                  The above post was deleted because the poster gave the full code with no explanation, no quidance - simply the answer. TSDN does not support this, as it is flat-out cheating, and a large number of posts here are from university students. Please read this thread for a full explanation of our policy in this regard.
                  hi Ganon,
                  that code was not actually the answer.actually it is a c++ code.MAC asked for
                  C code.it was not copied from anywhare .actually ,from last 8 hours i was working on that program when i got the result i felt that program would be useful
                  for mac's program.if i am wrong then sorry by heart.

                  Comment

                  • winox14
                    New Member
                    • Mar 2008
                    • 1

                    #10
                    i would to know what is the code for deletion

                    Comment

                    Working...