hi guys,
iam a beginner in c and i have got a project to make a program to keep the track of stock and cash of a shop i had done my work but i want to add purchase and iam unable to keep the work in history as a software works in shops so plz help me how i can make it i have to submit the program by tommorrow.

here is my program:

#include<stdio.h>
#include<conio.h>
void main()
{
    int stock=0,quan,ch;
    float mrp,cash=0;
    clrscr();
    while(1) {
        printf("\n1)SALE\n:");
        printf("\n2)TOTAL STOCK\n:");
        printf("\n3)TOTAL CASH IN HAND\n:");
        printf("\n5)EXIT\n:");
        printf("ENTER YOUR CHOICE:");
        scanf("%d",&ch);
        if(ch==1) {
            printf("\nENTER THE QUANTITY:");
            scanf("%d",&quan);
            printf("\nENTER THE TOTAL STOCK:");
            scanf("%d",&stock);
            stock=stock-quan;
            printf("\nENTER PRICE:");
            scanf("%f",&mrp);
            cash=mrp*quan;
            printf("\nTOTAL AMOUNT IS :%f",cash);
        } else if(ch==2) {
            printf("\nTHE TOTAL STOCK IS:%d",stock);
        } else if(ch==3) {
            printf("\nTHE TOTAL CASH IN HAND IS:%f",cash);
        } else if(ch==5) {
            exit(0);
        }
    }
    getch();
}

Recommended Answers

All 3 Replies

plz tell me how can i add purchase in choice menu and it gets added to the program and it works as a software and keep the record feeded in it.

why don't you use files so even if your program exits, Data will be available

plz tell me how can i add purchase in choice menu ...

Do you seriously not know how to add PURCHASE to the menu?

...and it gets added to the program ...

Follow the pattern set forth for the other items.

...and it works as a software ...

No idea what this means.

...and keep the record feeded in it.

Output the record to a file to be read next time the program starts.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.