Created
May 1, 2019 12:28
-
-
Save berkayakcay/5093043209acfb24e462850317ec5ca6 to your computer and use it in GitHub Desktop.
C++'da Piramit Çizimi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include | |
using namespace std; | |
class Piramit | |
{ | |
public: | |
Piramit(); | |
void ciz(); | |
void piramitGir(); | |
int satirSayisi; | |
char karakter; | |
}; | |
Piramit::Piramit() | |
{ | |
karakter=’*’; | |
satirSayisi=6; | |
} | |
void Piramit::ciz() | |
{ | |
system(“cls”); | |
int i,k,l,j; | |
int bosluk; | |
bosluk = satirSayisi-2; | |
for(i=0;i=i;j–) | |
{ | |
cout<<” “;} | |
for(k=1;k<=i;k++){ | |
cout<<karakter;} | |
for(l=0;l<=i;l++){ | |
cout<<karakter;} | |
cout<<endl; | |
} | |
} | |
void Piramit::piramitGir() | |
{ | |
int secim=2; | |
cout<<endl; | |
cout<<”Piramit satir Sayisi :”<<endl<<endl; | |
cout<<”1. Disaridan Gir :”<<endl; | |
cout<<”2. Varsayilan Kullan :”<>secim; | |
if(secim==1) | |
{ | |
cout<>satirSayisi;cout<=41) | |
{ | |
cout<<”Maksimum Satir Sayisi 40 Olmalidir…”; | |
cout<<endl<<”Tekrar giriniz..”<>satirSayisi; | |
} | |
} | |
else if(secim==2) | |
{ | |
satirSayisi; | |
} | |
} | |
int main() | |
{ | |
Piramit p1; | |
p1.piramitGir(); | |
p1.ciz(); | |
system(“pause”); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment