Как изменить эту программу на C
#include <iostream> #include <cmath> #include <fstream> #include <stdlib.h> using namespace std; void getInput(double price[],int quantity[], int totalItem) { for (int i = 0; i < totalItem; ++i) { cout << "Price of item " << (i+1) << " = ? "; cin >> price[i]; cout << "Quantity of item " << (i+1) << " = ? "; cin >> quantity[i]; } } void computeTotal(double price[],int quantity[],double total[], int totalItem) { for (int i = 0; i < totalItem; ++i) { total[i] = price[i]*quantity[i]; } } void displayResults(double price[],int quantity[],double total[], int totalItem) { cout << "\nThe sales summary is:\n"; cout << "Price($) Quantity Total($)\n"; cout << "-------------------------\n"; for (int i = 0; i < totalItem; ++i) { cout << price[i] << "\t " << quantity[i] << "\t " << total[i] << endl; } } int main () { int totalItem = 8; double price[8]; int quantity[8]; double total[8]; cout << "Please enter the price and quantity of 8 items\n"; getInput(price,quantity,totalItem); computeTotal(price,quantity,total, totalItem); displayResults(price,quantity,total, totalItem); return 0; }
Что я уже пробовал:
Я хочу изменить его на программирование на языке Си