输出一个星星组成的无限符号~
#include <tchar.h>
#include <iostream>
#include <math.h>
#define STAR_WIDTH 80
#define STAR_HEIGHT 24
int _tmain(int argc, _TCHAR* argv[])
{
bool table[STAR_WIDTH][STAR_HEIGHT] = {0};
for (int i = 0; i < STAR_WIDTH; i++)
{
int t = (int)(sin((float)i * 2 * 3.14f / STAR_WIDTH) * ((float)STAR_HEIGHT / 2) + ((float)STAR_HEIGHT / 2));
table[i][t] = true;
table[i][STAR_HEIGHT - t - 1] = true;
}
std::cout << std::endl << "ForeverStar by 腾袭" << std::endl << std::endl;
for (int y = 0; y < STAR_HEIGHT; y++)
{
for (int x = 0; x < STAR_WIDTH; x++)
{
if (table[x][y])
{
std::cout << "★";
} else {
std::cout << " ";
}
}
std::cout << std::endl;
}
//pause
std::cin.get();
return 0;
}

#include <tchar.h>
#include <iostream>
#include <math.h>
#define STAR_WIDTH 80
#define STAR_HEIGHT 24
int _tmain(int argc, _TCHAR* argv[])
{
bool table[STAR_WIDTH][STAR_HEIGHT] = {0};
for (int i = 0; i < STAR_WIDTH; i++)
{
int t = (int)(sin((float)i * 2 * 3.14f / STAR_WIDTH) * ((float)STAR_HEIGHT / 2) + ((float)STAR_HEIGHT / 2));
table[i][t] = true;
table[i][STAR_HEIGHT - t - 1] = true;
}
std::cout << std::endl << "ForeverStar by 腾袭" << std::endl << std::endl;
for (int y = 0; y < STAR_HEIGHT; y++)
{
for (int x = 0; x < STAR_WIDTH; x++)
{
if (table[x][y])
{
std::cout << "★";
} else {
std::cout << " ";
}
}
std::cout << std::endl;
}
//pause
std::cin.get();
return 0;
}
