1、
#include
using namespace std;
int main()
{
for (int i = 1; i < 10; i++)
{
for (int j = 1; j < 10; j++)
{
if (i >= j)
{
cout << j<<"*"< }
}
cout << endl;
}
system("pause");
return 0;
}
2、
#include
using namespace std;
int main()
{
int num = 0;
cout << "1、简单" << endl;
cout << "2、中等" << endl;
cout << "3、困难" << endl;
cout << "请选择难度" << endl;
cin >> num;
switch (num)
{
case 1:
cout << "你选择的是简单" << endl;
break;
case 2:
cout << "你选择的是中等" << endl;
break;
case 3:
cout << "你选择的是困难" << endl;
break;
}
system("pause");
return 0;
}
3、
#include
using namespace std;
int main()
{
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
if (j == 5)
{
break;
}
cout << 1;
}
cout << endl;
}
system("pause");
return 0;
}
4、
#include
using namespace std;
int main()
{
for (int i = 0; i <= 100; i++)
{
if (i % 2 == 0)
{
continue;
}
cout << i << endl;
}
system("pause");
return 0;
}
5、
#include
using namespace std;
int main()
{
cout << 1 << endl;
cout << 2 << endl;
cout << 3 << endl;
goto A;
cout << 4 << endl;
A:
cout << 5 << endl;
system("pause");
return 0;
}
6、
#include
using namespace std;
int main()
{
int arr[4];
arr[0] = 1;
arr[1] = 2;
arr[2] = 3;
arr[3] = 4;
int arr2[4] = { 1,2,3,4 };
int arr3[] = { 1,2,3,4 };
for (int i = 0; i < 4; i++)
{
cout << arr[i] << endl;
}
cout << sizeof(arr) << endl;
cout << sizeof(arr[1]) << endl;
cout << arr << endl;
cout << (int)arr << endl;
cout << &arr[1] << endl;
cout << (int)&arr[1] << endl;
system("pause");
return 0;
}
7、
#include
using namespace std;
int main()
{
int max = 0;
int arr[] = { 300,350,200,450,250 };
for (int i = 0; i < 5; i++)
{
if (arr[i] > max)
{
max = arr[i];
}
}
cout << max << endl;
system("pause");
return 0;
}



