輸入一組數值之後,可以輸入Ctrl+X,然後enter便出現結果
# include <iostream> //輸入一組數據之後,要輸入Ctrl+X,然後鍵入enter便出現結果
int main()
{
int amount = 0, value;
while (std::cin >> value)
if (value < 0) ++amount;
std::cout << "Amountof all negative values read is " << amount << std::endl;
system ("pause");
return 0;
}
<img src="https://img-blog.csdn.net/20140816143752137?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhbmd4aW40ODMy/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" />