猜商品价格
#include<iostream>
#include<stdio.h>
#include<string>using namespace std;int main()
{int trueprice = 98;cout << "物品的價格" << trueprice << endl;int price;//猜的價格while (1){cin >> price;if (price > trueprice)cout << "價格飛高了" << endl;else if (price < trueprice)cout << "價格低了" << endl;else{cout << "回答正確" << endl;break;}}system("pause");return 0;
}
總結(jié)