程序输出字符乱码为正方形
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr(); //to clear the screen
int i,j,n;
cout<<“Enter size of the square:”;
cin>>n;
for(i=0;i<n;++i)
{
cout<<“n”;
for(j=0;j<n;++j)
{
if(i==0||i==n-1||j==0||j==n-1)
cout<<“*”;
else
cout<<” “;
}
}
getch(); //to stop the screen
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr(); //to clear the screen
int i,j,n;
cout<<“Enter size of the square:”;
cin>>n;
for(i=0;i<n;++i)
{
cout<<“n”;
for(j=0;j<n;++j)
{
if(i==0||i==n-1||j==0||j==n-1)
cout<<“*”;
else
cout<<” “;
}
}
getch(); //to stop the screen
}
翻译自: https://www.thecrazyprogrammer.com/2012/07/c-program-to-print-following-square.html
程序输出字符乱码为正方形