#include<iostream>
using namespace std;
int main()
int quantity = 0;
int a = 0;
int b = 0;
int x = 0;
int y = 0;
int z;
double region[5][6];
int shipping = 20.00;
region[0][0] = 0;
for (x=0;x<5;x++) {
for (y=0; y<6; y++) {
z=x;
if(y == 0)
{region[x][y] = y + 1 + z;}
else if(y == 1)
{region[x][y] = region[x][y-1] * 2;}
else if(y == 2)
{region[x][y] = region[x][y-1] + .50;}
else if(y == 3)
{region[x][y] = region[x][y-1] + .50;}
else if(y == 4)
{region[x][y] = region[x][y-1] + .250;}
else
{region[x][y] = region[x][y-1] + .250;}
}
}
cout<<"Please input the region"<<endl;
cin>>a;
cout<<"Enter quantity"<<endl;
cin>>quantity;
if (quantity > 6)
{b = 5;}
else
{b = quantity;}
cout<<"The price of shipping comes out to: "<<region[a][b] + shipping<<" Since $20 is added for the shipping cost"<<endl;
return 0 ;
}
所以现在我必须为区域和数量输入 0,0 才能获得第一个单元格。但由于我从区域 1 和数量 1 开始,所以我要让用户输入 1,1。我将如何使用 C++ 进行此操作。谢谢!