1.1. ¶
~cpp
#include<iostream>
#include<string>
using namespace std;
int main()
{
//
for(int i=0; i<5; i++)
{
string space(4-i,' ');
cout << space;
string star(2*i+1,'*');
cout<<star;
cout<<endl;
}
cout<<"--------------------------------------------"<<endl<<endl;
//
for( i=0; i<5; i++)
{
for(int k =0 ; k< i ; k++)
cout<<" ";
for(int j=0;j<9-2*i; j++)
cout<<"*";
cout<<endl;
}
cout<<"--------------------------------------------"<<endl<<endl;
//
int size = 11;
for(i=0; i<size; i++)
{
string space(abs(size/2-i),' ');
cout << space;
if(i < size/2+1)
{
for(int j=0; j< (2*i+1) ; j++)
cout<<"*";
}
else
{
for(int j=0; j< size-2*(i-size/2) ; j++)
cout<<"*";
}
cout<<endl;
}
return 0;
}
1.2. ¶
~cpp
#include <iostream>
using namespace std;
int main()
{
cout << " ( 개) = ";
int row;
cin >> row;
// &
for (int i=0;i<row;i++)
{
for (int j=i+1;j<row;j++)
cout << " ";
for (j=2*i+1;j>0;j--)
cout << "*";
for (j=i+1;j<row;j++)
cout << " ";
for (j=i;j>0;j--)
cout << " ";
for (j=2*i+1;j<2*row;j++)
cout << "*";
cout << endl;
}
//
for (i=0;i<row;i++)
{
for (int j=abs(row-i*2-1)/2-1;j>=0;j--)
cout << " ";
for (j=abs(row-i*2-1);j<row;j++)
cout << "*";
cout << endl;
}
// 각
for (i=0;i<row;i++)
{
for (int j=i+1;j>0;j--)
cout << "*";
for (j=i;j<row;j++)
cout << " ";
for (j=i;j<row;j++)
cout << "*";
for (j=2*i+1;j>0;j--)
cout << " ";
for (j=i;j<row;j++)
cout << "*";
for (j=i;j<row;j++)
cout << " ";
for (j=i+1;j>0;j--)
cout << "*";
cout << endl;
}
return 0;
}
1.3. ¶
~cpp
#include <iostream>
#include <string>
using namespace std;
int main()
{
int row;
cin >> row;
int j = 0;
for(j = 0; j < row; j++) //
{
string spaces(row-(j+1), ' ');
string asterisks(j*2+1, '*');
cout << spaces;
cout << asterisks;
cout << "\n";
}
cout << "\n";
for(j = row - 1; j >= 0; j--) //
{
string spaces(row-(j+1), ' ');
string asterisks(j*2+1, '*');
cout << spaces;
cout << asterisks;
cout << "\n";
}
cout << "\n";
int middle = row / 2 + 1; //
for (j = 0; j < middle; j++)
{
string spaces(middle-(j+1), ' ');
string asterisks(j * 2 + 1, '*');
cout << spaces;
cout << asterisks;
cout << "\n";
}
for (j = middle-1; j > 0; j--)
{
string spaces(row-(middle+j-1), ' ');
string asterisks(j*2-1, '*');
cout << spaces;
cout << asterisks;
cout << "\n";
}
return 0;
}
1.4. ¶
~cpp
#include <iostream>
using namespace std;
int main()
{
char star = '*';
char space = ' ';
int number;
int numberu;
int dia;
//
cout << " : ";
cin >> number;
int i, j;
for (i=0; i<number; i++)
{
for (j=number-i-1; j>0; j--)
cout << space;
for (j=0; j<=i*2; j++)
cout << star;
cout << "\n";
}
//
cout << " : ";
cin >> numberu;
for (i=0; i<=numberu; i++)
{
for (j=0; j<i; j++)
cout << space;
for (j=numberu+4; j>i*2; j--)
cout << star;
cout << "\n";
}
return 0;
}
1.5. ¶
~cpp
그 고 곧 ㅋㅋ 구 ㅋㅋ ㅋㅋㅋ
#include <iostream>
#include <string>
using namespace std;
void main()
{/*
for(int row =0; row <5 ; row ++)
{
for (int col = 4-row ; col >0 ; col--)
{
cout <<" ";
}
for(int col2=1; col2 <=2*row +1 ; col2++){
cout <<"*";
}
cout << endl;
}
//cout << endl;
int temp =9;
for(int row2 =0; row2 <5 ; row2++)
{
for(int col3 =0; col3<row2 ; col3++)
{
cout << " ";
}
for(int col4=temp ;col4>0;col4--)
{
cout << "*";
}
temp = temp-2;
cout << endl;
}
cout << endl;*/
int temp =9;
for(int irow =0 ; irow <10; irow++)
{
for(int icol=0; icol <(abs(5-irow)) ; icol++)
{
cout <<"=";
}
for(int icol2=0; icol2 <=2*irow +1 ; icol2++){
cout <<"*";
}
for(int icol3=temp ;icol3>0;icol3--)
{
cout << "*";
}
temp=temp-2;
cout << endl;
}
}










