You are given an array of doubles of items in a store that have different prices (see template).
Write a program that takes the “percent off” discount as input and outputs discounted item prices on one line in the same sequence you are given, separated by a space (" ").
Sample Input
25
Sample Output
375 9.3 70.5 33.75 2.25 60.75 750.675 63.75 67.5 0.75 26.25
//My code
#include <iostream>
using namespace std;
int main() {
double items[] = {500, 12.4, 94, 45, 3, 81, 1000.9, 85, 90, 1, 35};
int discountNum; //定义折扣
double priceDis; //定义折扣后价格
cin>>discountNum;//输入折扣
for(int x = 0;x<11;x++){
priceDis=items[x]-items[x]*discountNum/100;
cout<<priceDis<<" ";
}
//折扣后价格=原价-原价*折扣/100
return 0;
}