Re: [問題]有關for的問題
現在情況是
可以輸出使用者要求的數字個數
也可以輸出最小值
但卻無法列出使用者打出的所有數字
#include<iostream>
using std::cout;
using std::endl;
using std::cin;
int main()
{
int min;
int number;
int smallest;
int smallestCounter;
cout<<"please enter how many numbers you want to enter?";
cin>>number;
for(smallestCounter=1; smallestCounter<=number; smallestCounter++)
{
cout<<"enter numbers you want to compare:";
cin>>smallest;
if (smallest<min)
min=smallest;
}
cout<<number<<" ";
cout<<"\nmin= "<<min;
system("pause");
return 0;
}
最後是要輸出smallestCounter還是smallest啊?
還是...要輸出其他東西?
請問各位了 謝謝!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 58.114.96.134
推
12/28 21:29, , 1F
12/28 21:29, 1F
→
12/28 21:29, , 2F
12/28 21:29, 2F
→
12/28 23:19, , 3F
12/28 23:19, 3F
→
12/29 02:39, , 4F
12/29 02:39, 4F
→
12/29 04:15, , 5F
12/29 04:15, 5F
→
12/29 04:16, , 6F
12/29 04:16, 6F
→
12/29 13:19, , 7F
12/29 13:19, 7F
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章
14
30