五、完善程序一

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<iostream>
#include<vector>
using namespace std;

bool isSquare(int num) {
    int i = ______;
    int bound = ______;
    for (; i <= bound; ++i) {
        if (______) {
            return ______;
        }
    }
    return______;
}

int main() {
    int n;
    cin >> n;
    if (isSquare(n)) {
        cout << n << " is a square number" << endl;
    } else {
        cout << n << " is not a square number" << endl;
    }
    return 0;
}
Scroll to Top