15 6 C:\ Users \ PAUL \ Documents \ Benson C ++ \ draw hw 2.cpp [错误]'i'的名称查找已更改为ISO'for'范围[-fpermissive]
14 5 C:\ Users \ PAUL \ Documents \ Benson C ++ \ draft hw 2.cpp [注意](如果使用'-fpermissive',G ++将接受您的代码)
1 #include <iostream>
2 using namespace std;
3 int main()
4
5 {
6 int num;
7 int ok, ko;
8
9 cout << "Enter the maximum limit: ";
10 cin >> num;
11
12 for(int i=1;i<=num;i++);
13
14 {
15 ko= i%2;
16 if(ko==0)
17 cout << "-" << i << endl;
18
19 ok = i%2>0;
20 if(ok>0)
21 cout <<i<<endl;
22 }
23
24
25 return 0;
26
27
28 }