Begin, where coders usually begin; with paper or notepad or VI and lay out your requirements, followed by your FNC()'s, followed by you var's ( with a good naming convention.)
Then, develop your program using Pseudo code first !
=====
// REQUIREMENTS
#1)- " At a shop were brought "n" sortiments of groceries (numbered from 1 to n),
#2)- the amount for every sortiment is known (expressed in pieces) ,
#3)- the acquisition price and (expressed in % of the acquisitions price)
the commercial addition (expressed in % of the acquisitions price) .
#4)- In one week there were counted by days the quantity of every sold product.
#5)- Make a program that shows the maximum value of sales made in one day and
#6)- the value of sales made weekly by a "x" product."
// =====================
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
// PROGRAM STRUCTURE & LAYOUT
#include stdio.h
Main()
{
GetItems() // ( #1)
.....from 1 to 5
..........GetAmts() // ( #2 )
Convert() // convert act & comm prices to % ( #3)
Weekly_tally() // ( #4 )
Max_Day_Val() // (#5)
Single_Week_Sale() // (#6)
RETURN 0;
} // EOF - EOR
|
Now continue to break-down each piece, each subrt'n into more, and more, greater and greater detail until it's functional - THEN type it into your compiler and test it.
Remember to use VAR names that ate meaningful; not x,y,z, or amt, type, rtn, this,that, more,
but more like this:
INT i_sales_Rate
DOUBLE d_product_percent
a_weekly_array[i_max_arry_val]
BTW, a "Structure" is only a grouping of vars - so this will be a lst step in your design phase.