Em có thắc mắc cần hỏi ạ. Em đang không biết tính tổng tiền số hàng thuế và tổng cộng luôn cả thuế là nhiêu ạ. Làm sao em có thấy lấy được mảng và cộng với nhau ạ
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;
int ReadData(string items[],double val[], int amount[]) {
int counter = 0;
while (1) {
cout << "Enter item "<<counter +1 <<" : " ;
cin >> items[counter];
if (items[counter] == "NONE" || items[counter] == "none") {
cout << "______________________________________________________________________________" << endl;
cout << "\n";
break;
}
cout << "Enter Price per unit: ";
cin >> val[counter];
cout << "Enter Quantity: ";
cin >> amount[counter];
counter++;
cout << "------------------------";
cout << "\n";
}
return counter;
}
int main() {
int n1;
int choice;
string b_items[10];
double xval[10];
int xamount[10];
int counter = 0;
counter = ReadData(b_items, xval, xamount);
cout << "\tItem\t\tQuantity\t\tPrice\t\tTotal\t\t\n";
for (int i = 0; i < counter; i++) {
int total;
total = xamount[i] * xval[0];
cout <<"\t"<< b_items[i] << "\t\t" << xamount[i] << "\t\t\t" << xval[i] << "\t\t"<<total<<"\t\t";
cout << endl;
cout << "______________________________________________________________________________"<< endl;
cout << "\n";
}
cout << "TOTAL: ";
cout << "TAX";//(7.5%)
cout << "Final Total"
}