所以基本上我創建了一個程序來詢問用戶他們想要測試程序的次數。但是我無法弄清楚for循環的問題。所以:C for循環故障排除
- 如果用戶想要測試該程序3次,它應該要求3次的值,它應該退出後。
這是我的代碼如下:
#include <stdio.h>
int main()
{
int test;
printf("How many times do you want to test the program?");
scanf("%d", &test);
test = 0; // Reinitializing the test from 0
for (test=0; test=>1; test++) //I cant figure out whats going on with the for loop.
{
printf("Enter the value of a: \n");
scanf("%d", &test);
;
}
return 0;
}
輸出應該是: 「有多少次你想測試程序」:3 輸入的值:任何數值 輸入a的值:任何數值 輸入a的值:任何數值 (出口)
您閱讀測試,然後立即將其設置爲零。 –
你知道循環是如何工作的嗎? –
[The Definitive C Book Guide and List](https://stackoverflow.com/questions/562303/the-definitive-c-book-guide-and-list) –