首页 > 代码库 > 一道C++题目

一道C++题目

 1 #include <iostream>
 2 using namespace std;
 3 
 4 int main()
 5 {
 6     int length;
 7     cout << "样本输入:"<<endl; 
 8     cin >> length;
 9     cout << "样本输出:"<<endl; 
10     for (int i = 1; i <= length; i++) 
11     {
12         for (int j = 1; j <= length; j++) 
13         {
14              cout << " ("<<i<<","<<j<<") ";
15              if (j == length) 
16              {
17                  cout << "\n";    
18              }
19         }
20     }
21     return 0;
22 }

技术分享

一道C++题目