Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- void cuadrado(int *l) {
- for (int i = 1; i <= *l; i++)
- {
- for (int j = 1; j <= *l; j++)
- {
- cout << " *";
- }
- cout << endl;
- }
- }
- void rectangulo(int *l) {
- for (int i = 1; i <= l[0]; i++)
- {
- for (int j = 1; j <= l[1]; j++)
- {
- cout << " *";
- }
- cout << endl;
- }
- }
- void rombo(int *l) {
- do
- {
- cout << "Ingrese numero entre los valores de 1 y 11: ";
- cin >> *l;
- } while (*l<0||*l>11);
- for (int i = 1; i <= *l; i++)
- {
- for (int k = *l - 1; k >= i; k--)
- {
- cout << " ";
- }
- for (int j = 1; j <= i; j++)
- {
- cout << " * ";
- }
- cout << endl;
- }
- for (int i = 1; i <= *l; i++)
- {
- for (int k = 1; k <= i; k++)
- {
- cout << " ";
- }
- for (int j = *l-1; j >= i; j--)
- {
- cout << " * ";
- }
- cout << endl;
- }
- cin.get();
- }
- void menu(int *op) {
- cout << "MENU:" << endl;
- cout << "1.Cuadrado" << endl;
- cout << "2.Rectangulo" << endl;
- cout << "3.Rombo" << endl;
- do
- {
- cout << "Ingrese Opcion: ";
- cin >> *op;
- } while (*op<0 || *op>3);
- }
- void ingresoDatos(int *l) {
- cout << "Ingrese lado 1: ";cin >> l[0];
- cout << "Ingrese lado 2: ";cin >> l[1];
- }
- int main() {
- int opcion;
- int r;
- int *lados = new int[2];
- int l;
- do
- {
- menu(&opcion);
- switch (opcion)
- {
- case 1:cout << "Ingrese lado: ";cin >> l;cuadrado(&l);break;
- case 2:ingresoDatos(lados);
- rectangulo(lados);break;
- case 3: rombo(&r);
- default:
- break;
- }
- } while (opcion!=3);
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement