Paste
Pasted as C++ by registered user xujiayu ( 4 years ago )
#include <stdio.h>
#include <conio.h>
#include <Windows.h>
#include <iostream>
#include <iomanip>
using namespace std;
/*
* bai 14
ve hinh
*/
void vehcn(int chieudai , int chieurong)
{
for (int i = 1; i <= chieurong; i++)
{
for (int j = 1; j <= chieudai; j++)
{
Sleep(500);
printf("*");
}
printf("\n");
}
}
void hcnrong(int chieudai , int chieurong)
{
for (int i = 1; i <= chieurong; i++)
{
if(i == 1 || i == chieurong)
for (int j = 1; j <= chieudai; j++)
{
Sleep(500);
printf("*");
}
else
{
for (int j = 1; j <= chieudai; j++)
{
if (j == 1 || j == chieudai)
{
Sleep(500);
printf("*");
}
else
{
Sleep(200);
printf(" ");
}
}
}
printf("\n");
}
}
void vetamgiavdac(int canh)
{
for (int i = 1; i <= canh; i++)
{
for (int j = 1; j <= i; j++)
{
Sleep(500);
printf("*");
}
printf("\n");
}
}
void vetamgiaccan(int canh)
{
for (int i = 1; i <= canh; i++)
{
for (int j = 1; j <= 2 * i - 1; j++)
{
Sleep(500);
printf("*");
}
printf("\n");
}
}
void vetamgiacrong(int canh)
{
int x = 20;
int khoangcachbandau = x - 2;
for (int i = 1; i <= canh; i++)
{
Sleep(500);
int khoangcach = x - i * 2;
cout << setw(khoangcach)<< "*";
if(i != 1 && i != canh)
{
Sleep(500);
khoangcachbandau += 2;
cout << setw(khoangcachbandau - khoangcach) << "*";
}
if(i == canh)
{
khoangcachbandau += 2;
//cout << setw(khoangcachbandau - khoangcach) << "*";
for(int j = 1;j <=(khoangcachbandau -khoangcach);j++)
{
Sleep(500);
cout << "*";
}
}
cout << endl;
}
}
int main()
{
//int chieurong = 4;
//int chieudai = 7;
int canh = 5;
//vehcn(chieudai,chieurong);
//hcnrong(chieudai,chieurong);
//vetamgiavdac(canh);
//vetamgiaccan(canh);
/*Sleep(1000);
printf("\nAi noi quen IT buon,quen IT ga la khong co buon nhe hehe\n\n");
Sleep(1500);
printf("*****\t*\t ***\t* *\t******\t* *");
Sleep(1500);
printf("\n *\t*\t* *\t * *\t*\t* *");
Sleep(1500);
printf("\n *\t*\t* *\t * *\t*****\t* *");
Sleep(1500);
printf("\n *\t*\t* *\t * *\t*****\t* *");
Sleep(1500);
printf("\n *\t*\t* *\t * *\t*\t * *");
Sleep(1500);
printf("\n*****\t*****\t ***\t **\t\t******\t *****");*/
vetamgiacrong(canh);
getch();
return 0;
}
Revise this Paste