1、年龄几何
3、三色球
<pre name="code" class="cpp">#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int a, n, i, s;
for (a = 1; a <= 4; a++)
for (n = 1; n <= 6; n++)
if (n * 4 + a * 6 == 26 && n*(n + a)*(n + a + a)*(n + a + a + a) == 880)
{
cout << n;
for (i = 1; i<20; i++)
{
s = n + a*i;
cout << "、" << s;
}
cout << endl;
}
else
{
cout << endl;
}
system("pause");
return 0;
}
2、输出星型图形
#include<iostream>
using namespace std;
int main()
{
int i, j, n = 6;
for (j = 1; j <= n - 1; j++)
cout << " ";
cout << "*" << endl;
for (i = 2; i <= n - 1; i++)
{
for (j = 1; j <= n - i; j++)
cout << " ";
cout << "*";
for (j = 1; j <= 2 * i - 3; j++)
cout << " ";
cout << "*" << endl;
}
for (j = 1; j <= 2 * n - 1; j++)
cout << "*";
cout << endl;
system("pause");
return 0;
}
3、三色球
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int n=1,i, j, k;
for (i = 0; i <= 3;i++)
for (j = 0; j <= 3;j++)
for (k = 0; k <= 6;k++)
if (i + j + k == 8)
cout << n++ << ":红球" << i << "个:白球" << j << "个:黑球" << k << ":个\n";
system("pause");
return 0;
}