ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Estructuras de control. Códigos


Enviado por   •  30 de Junio de 2023  •  Informe  •  3.691 Palabras (15 Páginas)  •  22 Visitas

Página 1 de 15

[pic 1][pic 2]


Códigos[pic 3][pic 4][pic 5][pic 6]

Ejercicio N°1:

#include<iostream>

#include<stdlib.h>

#include<conio.h>

#include<stdio.h>

using namespace std;

int main ()

{

        do

        {

                char a,b;

                

                cout<< "1- Calcular promedio \n";                

                cout<< "2- Ingresar promedio \n";

                cout<< "3- Salir del programa \n \n";

                cin >> a;

                

                switch (a)

                {

                        case 1:

                                {

                                        float n1,n2,n3,p;

                                        

                                        cout<<"favor ingresar primera nota"<<endl;

                                    cin >>n1;

                                

                                    cout<<"favor ingresar segunda nota"<<endl;

                                    cin >>n2;

                                

                                    cout<<"favor ingresar tercera nota"<<endl;

                                    cin >>n3;

                                

                                    p= (n1+n2+n3) /3;

                                

                                    cout<<"el promedio del estudiante es: "<<p<<endl;

                                    getch ();

                                    break;

                                }

                                

                                

                        case 2:

                            main();

                            {

                                    float promedio;

                                printf ("por favor ingrese el promedio");

                           

                            scanf("%f", &promedio);

                           

                            /*Uso de estructura doble = "if - else*/

                           

                            if (promedio>12)

                                {

                                        printf("materia aprobada");

                                }

                                else

                                {

                                        printf("materia reprobada");

                                }

                                getch();

                                break;

                                }

                           

                    case 3:

                              cout<< "favor confirmar decision si o no \n";

                                 

                                  cout<< "\n 1.- Si";

                                 

                                  cout<<"\n 2.- No\n \n";

                                  cin >> b;

                                 

                                  if (b=1)

                                  {

                                          return 0;

                                  }

                                  else

                                  {

                                          return main ();

                                  }

                                  break;

                        default:

                             return main ();

                                 break;                  

                }

        }

        while(a != 3);

        system("pause");

}

Ejercicio N°2:

#include <iostream>

using namespace std;

int main()

{

        

        int i, n, pares = 0, impares = 0;

        

        for (i = 1; i <= 6; i++) {

                

                cout<<" Favor ingresar un valor numérico: \t";

...

Descargar como (para miembros actualizados) txt (6 Kb) pdf (411 Kb) docx (295 Kb)
Leer 14 páginas más »
Disponible sólo en Clubensayos.com