0
嗨,我剛開始編程在C和我在努力寫旨在充分整數的字符串,然後輸出,如果被檢查的值比其前一個小的程序。但我不能讓程序重複數據,它似乎只是檢查第一個值。我嘗試過使用循環,但這使我更加困惑。抱歉提出這樣一個基本問題。這是我到目前爲止的代碼:獲取程序不斷重複輸入用C
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char *argv[]) {
int num;
int smaller=0;
printf("Input integers: ");
scanf("%d", &num);
if (num<smaller) {
printf("*** value %d is smaller than %d \n", num, smaller);
}
smaller=num;
return 0;
}
嗯.. 。如果你想重複一些你可能需要的循環...你有沒有試過按照基本的C語言教程來學習像/ while循環這樣的基本語言結構? – vanza
使用while循環。 – Phonon