所以我正在编写一个处理输入文件中的值的程序.我的变量包括总数,taxtotal,小计等等.它们已经被声明和初始化了,但是我收到两条错误消息:"未初始化的局部变量'小计'使用过'"和变量"taxtotal"相同. 源代码:
#include "stdafx.h"
#include<stdio.h>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
ifstream shoppingBasketFile;
shoppingBasketFile.open("HW3_Data.txt");
bool isTaxed = false;
char taxValue = 0;
char inPrice[64];
char name[128];
double price, taxtotal, subtotal, total = 0;
if (shoppingBasketFile.is_open())
{
// display the header info:
cout << "o Thank you for shopping at StuffMart" << endl;
cout << setw(3) << left << "o "
<< setw(20) << left << "Item"
<< setw(12) << "Unit Price"
<< …Run Code Online (Sandbox Code Playgroud)