标签:sys ios for else cst names signed space unsigned
#include<windows.h>
#include<cstring>
#include<time.h>
#include<iostream>
using namespace std;
const int h=10,w=50;
bool hx[h][w];
int wx=h/2,wy;
char c[]="Hello world!";
void wait()
{
for(int i=1;i<=100000000;i++);
}
int main(){
wy=w/2-strlen(c)/2;
srand((unsigned)time(NULL));
while(1){
system("cls");
for(int i=0;i<h;i++){
for(int j=0;j<w;j++)
if(!hx[i][j])
printf("%c",rand()%26+65);
else {
if(i==wx && j>=wy && j<=wy+strlen(c)-1)cout<<c[j-wy];
else cout<<‘ ‘;
}
cout<<endl;
}
//wait();
for(int l=1;l<=10;l++){
int x=rand()%h,y=rand()%w;
while(hx[x][y]){
x=rand()%h;
y=rand()%w;
}
hx[x][y]=1;
}
}
}
标签:sys ios for else cst names signed space unsigned
原文地址:http://www.cnblogs.com/A1269180380/p/7623411.html