Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //TECHNIQUE 1
- #include <iostream>
- using namespace std;
- int main()
- {
- int taille;
- char c = ' ';
- cout << "Entrez une taille : ";
- cin >> taille;
- cout << "Entrez un motif : ";
- cin >> c;
- switch(c)
- {
- case 'a':
- for(int i = 0; i<taille; i++)
- {
- cout << "*" << endl;
- }
- break;
- case 'b':
- for(int y=0; y<taille; y++)
- {
- for(int x=0; x<taille*2; x++)
- {
- cout << "*";
- }
- cout << endl;
- }
- break;
- case 'c':
- for(int y=0; y<taille; y++)
- {
- if(y==0 || y==taille-1)
- {
- for(int x=0; x<taille; x++)
- {
- cout << "*";
- }
- }
- else
- {
- cout << "*";
- for(int x=1; x<taille-1; x++)
- {
- cout << " ";
- }
- cout << "*";
- }
- cout << endl;
- }
- break;
- case 'd':
- for(int i = 0; i<taille; i++)
- {
- if(i%2 == 0)
- {
- cout << "*";
- }
- else
- {
- cout << " ";
- }
- }
- break;
- default:
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement