@samueladams
thanks alot for reply mate.
our study system in australia is a bit self based we were just told how to open and close the files but we have been given this tough program.
and we are using microsoft visual studio 2010 c language
"printf scanf fprintf f scanf"
so the getline thing is now working in here...
it will be somthing fscanf and fprintf
here's my code till now for you to understand it more accurately
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
#include <string.h>
#include "stdafx.h"
#include<math.h>
#include<stdio.h>
typedef struct{
char name[12];
int demandrate;
double setupcost;
double unitcost;
double inventorycost;
double sellingprice;
double eoq;
}product_t;
product_t coffee;
product_t choc;
product_t tea;
product_t cake;
product_t pie;
typedef struct{
product_t coffee;
product_t choc;
product_t tea;
product_t cake;
product_t pie;
}stores_t;
stores_t callaghan;
stores_t lambton;
int main(void)
{
int selection;
FILE *f_in;
char store1[8]="lambton";
char store2[11]="callaghan";
printf("Welcome To Bestbean Coffee Replenishment System\n");
printf(" 1.Read File\n 2.Input Data\n 3.Display Store\n 4.Display Product\n 5.Save File\n 6.Exit\n What Would you Like To Do?(1-6)\n >");
scanf("%i",selection);
if (selection == 1);{/*Read File*/
f_in =fopen("input.txt","r");
if (f_in == NULL){
printf("No File Found");
}
else{
fscanf("%s
}
}
if (selection == 2);{/*Input Data*/
}
if (selection == 3);{/*Display Store*/
}
if (selection == 4);{/*Display Product*/
}
if (selection == 5);{/*Save File*/
}
if (selection == 6);{/*Exit*/
}
return 0;
}
|
The program is about a coffee shop brand which have two shops in suburbs of lambton and callaghan.
and each shop have 5 products coffee,chocolate,tea,cake,pie.
and each product have some data which the owner need to be aware of like name of product,demand rate,setup cost,unit cost,inventory cost,selling price,and another calculated value EOQ(economic Order Quantity).
on basis of this we need to make a program with the first screen asking for input from user like this.