do...while

    xiaoxiao2021-04-15  26

    实例:不断提示用户输入一对数,然后求其和

    string rsp; do{ cout << "please enter two numbers:" << endl; int val1,val2; cin >> val1 >> val2; cout << "the sum of " << val1 << "and " << val2 << "is: " << val1 + val2 << endl; cout << "more? Enter yes or no " << endl; cin >> rsp; } while (rsp.empty() && rsp[0] != 'n');
    转载请注明原文地址: https://ju.6miu.com/read-671664.html

    最新回复(0)