#33929: C++參考


48985654 (天涯海神)


#include <iostream>
#include<iomanip>
using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
    int a;
    double b,c,price;
    cout<<"輸入幾件藝術品"<<endl;
    cin>>a; 
    for(int i=0;i<a;i++){
        cin>>b>>c;        
        price=(c/b-1)*100;
        if(price<=-7.00 || price>10.00){
            cout<<fixed<<setprecision(2)<<price    <<"%"<<"dispose"<<endl;    
        }else{
            cout<<fixed<<setprecision(2)<<price    <<"%"<<"keep"<<endl;        
        }

    }
    return 0;
}