#include<iostream>
using namespace std;
/*void test01()
{
int a = 10;
int b = 20;
int c = 30;
cout << "a=" << a << endl;
cout << "b=" << b << endl;
cout << "c=" << c << endl;
if (a > b && a > c)
{
cout << "小猪a最重,a=" << a << endl;
}
else if (b > a && b > c)
{
cout << "小猪b最重,b=" << b << endl;
}
else
{
cout << "小猪c最重,c=" << c << endl;
}
}*/
/*void test02()
{
int num = rand() % 100 + 1;//随机数生成
//cout << "num=" << num << endl;
int a = 0;
cout << "请玩家输入数字:" << endl;
while (1)
{
cin >> a;
if (num > a)
{
cout << "猜测过小" << endl;
}
else if (num < a)
{
cout << "猜测过大" << endl;
}
else
{
cout << "回答正确" << endl;
break;
}
}
}*/
/*void test03()
{
int num = 99;
cout << "水仙花数为:" << endl;
while (num<999)
{
num++;
int a = 0;
int b = 0;
int c = 0;
a = num % 10;
b = num / 10 % 10;
c = num / 100;
if (a*a*a + b*b*b + c*c*c == num)
{
cout << num << endl;
}
}
}*/
/*void test04()
{
for (int i = 1; i <= 100; i++)
{
if (i%10 == 7 || i/10 == 7 || i%7 ==0)
{
cout << "敲桌子" << endl;
}
else
{
cout << i << endl;
}
}
}*/
void test05()
{
for (int i = 1; i < 10; i++)
{
for (int j = 1; j <= i; j++)
{
cout << i << "*" << j << "=" << i * j << "\t";
}
cout << endl;
}
}
int main()
{
//test01(); //三只小猪比较体重
//test02();//猜数字
//test03();//水仙花数
//test04();//敲桌子
test05();//乘法口诀
system("pause");
return 0;
}
黑马C++基础前四章例子
最新推荐文章于 2024-09-02 20:21:30 发布