[問題]有關for的問題
小弟是新手
有一個程式是要寫出用for迴圈
print出
6 21 5 43 96 54 1
the smallest is 1
6代表的是使用者自訂要輸入6個數字
剩下的數字代表的是使用者輸入的數字
最後是輸出最小值
請問小弟下列的程式要怎麼改才會有這種效果阿
for不就會一直跑回圈嗎?
怎麼還能自訂數字呢?
#include<iostream>
using std::cout;
using std::endl;
using std::cin;
int main()
{
int number;
int smallest;
int count;
cout<<"please enter how many numbers you want to enter?";
cin>>number;
for (count=1; count<=number; count++)
{
cout<<count<<" ";
}
system("pause");
return 0;
}
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 58.114.96.134
※ 編輯: wupeiing 來自: 58.114.96.134 (12/28 19:52)
※ 編輯: wupeiing 來自: 58.114.96.134 (12/28 19:56)
推
12/28 20:06, , 1F
12/28 20:06, 1F
→
12/28 20:07, , 2F
12/28 20:07, 2F
→
12/28 20:14, , 3F
12/28 20:14, 3F
推
12/28 20:26, , 4F
12/28 20:26, 4F
→
12/28 20:27, , 5F
12/28 20:27, 5F
→
12/28 20:27, , 6F
12/28 20:27, 6F
→
12/28 20:28, , 7F
12/28 20:28, 7F
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章
14
30