Does anyone have any ideas of how I can make this job easy for myself. As you can see, this array of structures contains 100. It will take me a long time to type every detail in manually, Im sure theres a easier way round this. I thought of using a for statement to count me all the way through promting me for the deatails then puting them in the relevant place, can anyone give me an example of this idea (if it is the best way).
Code:#include<stdio.h> #include<conio.h> struct database { char prod[50]; float cal; float carb; float prot; float fat; }; int main() { struct database mainm[100]; strcpy(mainm[1].prod, "Chips tesco steak cut oven"); mainm[1].cal = 141.0; mainm[1].carb = 24.4; mainm[1].prot = 2.0; mainm[1].fat = 3.9; strcpy(mainm[1].prod, "Chips asda steakcut frying"); mainm[2].cal = 187.0; mainm[2].carb = 28.0; mainm[2].prot = 2.9; mainm[2].fat = 7.0; getch(); }