我正在用 C++ 做一个税收计算器,但我有一个错误它应该输入几个数据:车辆类型、日期和型号。但是程序在暂停前只问了我一个,并没有继续。
假设操作如下:您输入一种车辆,然后输入发行日期,最后输入它的价格。
鉴于这些数据,该程序应该计算必须包含的税收百分比。
但正如我所说,程序在询问第二个数据(年份)之前暂停。
这是代码
#include <iomanip>
#include <iostream>
using namespace std;
int main(){
std:string a;//tipo
int b;//año
double c;//precio
char d;//resultado
cout << "Ingrese el tipo:";
cin >> a;
cout << "Ingrese el año:";
cin >> b;
cout << "Ingrese el precio:";
cin >> c;
if (a = "automovil" && b <= 1980){
d = c*100/3.3;
}else if ( a == "automovil" && b <= 1990){
d = c*100/5.5;
}else if ( a == "automovil" && b <= 2000){
d = c*100/7;
}else if ( a == "automovil" && b <= 2010){
d = c*100/10;
}else if ( a == "camioneta" && b <= 1980){
d = c*100/3.3;
}else if ( a == "camioneta" && b <= 1990){
d = c*100/5.5;
}else if ( a == "camioneta" && b <= 2000){
d = c*100/7;
}else if ( a == "camioneta" && b <= 2010){
d = c*100/10;
}else if ( a == "camion" && b <= 1980){
d = c*100/3.3;
}else if ( a == "camion" && b <= 1990){
d = c*100/5.5;
}else if ( a == "camion" && b <= 2000){
d = c*100/7;
}else if ( a == "camion" && b <= 2010){
d = c*100/10;
}else if ( a == "volqueta" && b <= 1980){
d = c*100/3.3;
}else if ( a == "volqueta" && b <= 1990){
d = c*100/5.5;
}else if ( a == "volqueta" && b <= 2000){
d = c*100/7;
}else if ( a == "volqueta" && b <= 2010){
d = c*100/10;
}
cout << d;
return 0;
}
有什么建议么?