#include <stdio.h>
#include <iostream>
using namespace std;
void x1();
void x2();
void x3();
char *n[4]={" "," "," "," "};
double c[4] ={0,0,0,0};
double s[4] ={0,0,0,0};
double t[4] ={0,0,0,0};
int i,imax;
void main() {
system("cls");
cout << "How much : ";
cin >> imax;
x1();
x2();
x3();
getchar();
}
void x1() {
for (i=0;i<imax;i++) {
cout << "Name : ";
cin >> n[i];
cout << "Cream : ";
cin >> c[i];
cout << "Soap : ";
cin >> s[i];
}
}
void x2() {
for (i=0;i<imax;i++) {
cout << n[i] << " : ";
cout << c[i] << " : ";
cout << s[i] << " : ";
t[i] = (c[i] * 0.05) + (s[i] * 0.1);
cout << t[i] << "\n";
}
}
void x3() {
double x=0;
for (i=0;i<imax;i++) {
x = x + t[i];
}
cout << "Total : "<< x;
}
| |