版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/LYJ_viviani/article/details/62893383
#include <iostream>
using namespace std;
int main()
{
int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
for (int i = 0; i < 10; i++)
{
if (a[i] > 5) cout << "mistake" << endl;
return 0;
a[i] = a[i] + 1;
}
for (int j = 0; j < 10; j++)
{
cout << a[j] << " ";
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
for (int i = 0; i < 10; i++)
{
if (a[i] > 5) cout << "mistake" << endl;
break;
a[i] = a[i] + 1;
}
for (int j = 0; j < 10; j++)
{
cout << a[j] << " ";
}
return 0;
}