qq_32554019 于 2016.03.31 11:04 提问

#include using namespace std; int main() { int n; cin >> n; int * p = new int[n * 2]; int i; for (i = 0; i < n; i++) { cin >> p[i * 2]; cin >> p[i * 2 + 1]; } for (i = 0; i < n; i++) { int a = p[i * 2]; int b = p[i * 2 + 1]; if (a > b || a <= 0 || b >= 10) { cout << "Input Error!"; continue; } for (int j = a; j <= b; j++) { for (int k = 1; k <=j; k++) { cout << j << "*" << k << "=" << j * k << "\t"; } cout << endl; } if (i != n - 1) cout << endl; } return 0; }

3个回答

qq423399099      2016.03.31 11:25

`````` #include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
int * p = new int[n * 2];
int i;
/*
for (i = 0; i < n; i++) {
cin >> p[i * 2];
cin >> p[i * 2 + 1];
} */
for (i = 0; i < n; i++) {
//int a = p[i * 2];
//int b = p[i * 2 + 1];
int a, b;
cin >> a >> b;
if (a > b || a <= 0 || b >= 10) {
cout << "Input Error!";
continue;
}
for (int j = a; j <= b; j++) {
for (int k = 1; k <=j; k++) {
cout << j << "*" << k << "=" << j * k << "\t";
}
cout << endl;
}
if (i != n - 1)
cout << endl;
}
return 0;
}
``````
flx413   2016.03.31 23:50

huatian5   2016.04.03 11:58