martes, 26 de noviembre de 2019

Ejercicio 23

#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
void menu();
void captura();
void imprime();
int vec[10],j,k,op;
int main()
{
do
{
menu();
} while(op!=3);
return 0;
}
void menu()
{

cout<<"1.captura"<<endl;
cout<<"2.imprimir"<<endl;
cout<<"3.salir"<<endl;
cin>>op;
switch(op)
{
case 1:
captura();
break;
case 2:
imprime();
break;
case 3:
cout<<"gracias por usar el sistema"<<endl;
break;
default:
cout<<"opcion erronea";
}
}
void captura()
{
cout<<"funcion captura";
for(j=0;j<=9;j++){
cout<<"captura un numero"<<endl;
cin>>vec[j];

}
cout<<"fin funcion captura"<<endl;

}
void imprime()
{
cout<<"funcion imprime"<<endl;
for(j=0;j<=9;j++){
cout<<"El numero en la pocision"<<j<<"es"<<vec[j]<<endl;


}
cout<<"fin funcion imprime"<<endl;
}

ejercicio 22

#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

void captura ();
void suma ();
void resta ();
void multiplicacion();
void division();
void salir ();
float n1,n2;
int s,r,m,d;
int main(){
captura();
suma();
resta();
multiplicacion();
division();
salir();

 return 0;
}

void captura()
{
cout<<"CAPTURA"<<endl;
cout<<"ingresa el primer numero"<<endl;
cin>>n1;
cout<<"ingresa el segundo numero"<<endl;
cin>>n2;
cout<<"Fin funcion captura"<<endl;
}
void suma()
{

cout<<"suma"<<endl;
s=n1+n2;
cout<<"el resultado de la suma es"<<s<<endl;
cout<<"fin funcion suma"<<endl;
}
void resta()
{
cout<<"resta"<<endl;
r=n1-n2;
cout<<"el resultado de la resta es"<<r<<endl;
cout<<"fin funcion resta"<<endl;
}
void multiplacion()
{
cout<<"Multiplicacion"<<endl;
m=n1*n2;
cout<<"el resultado de la multiplicacion es"<<m<<endl;
cout<<"fin funcion multiplicacion"<<endl;
}
void division()
{
cout<<"division"<<endl;
d=n1/n2;
cout<<"el resultado de la multiplicacion es"<<d<<endl;
cout<<"fin funcion multiplicacion"<<endl;
}
void salir()
{
cout<<"funcion salir"<<endl;
cout<<"funcion salir fin"<<endl;
}

jueves, 21 de noviembre de 2019

Examen de converciones

#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
int op;
double mm,m,km,cm,pies,by,gb,mb,kb,l,cme,dme,me, s;
int main()
{
cout<<"Menu De Opciones"<<endl;
cout<<"CONVERSIONES"<<endl;
cout<<"1.Longitud"<<endl;
cout<<"2.informacion"<<endl;
cout<<"3.Capacidad"<<endl;
cout<<"4.Salir"<<endl;
    cin>>op;
    switch(op){
case 1:
cout<<"Longitud"<<endl;
cout<<"Ingresa los metros para convertir a longitud";
cin>>m;
km=m/1000;
cm=m*100;
mm=m*1000;
pies=km*3.28;
cout<<"La medida convertida en kilometros es:"<<km<<endl;
cout<< "La medida convertida en centimtros es:"<<cm<<endl;
cout<<"la medida convertida a mililitros es:"<<mm<<endl;
cout<<"La medida convertida a pies es:"<<pies<<endl;

break;

case 2:
cout<<"IMFORMACION"<<endl;
cout<<"Ingrese la medida en bytes";
cin>>by;
kb=by;
kb=by/1024;
mb=by/1048576;
gb=by/1073741824;
cout<<"La medida en kilobytes es:"<<kb<<endl;
cout<<"La medida en megabyte es:"<<mb<<endl;
cout<<"La medida en gygabytees:"<<gb<<endl;
break;

case 3:
cout<<"Capacidad"<<endl;
cout<<"ingrese la medida litros"<<endl;
cin>>l;
cme=l*100;
dme= l;
me=l/1000;
cout<<"la medida en cm3 es:"<<cme<<endl;
cout<<"la medida en decimetros cubicos es:"<<dme<<endl;
cout<<"la medida en m3 es"<<me<<endl;
    break;
   
    case 4:
    break;
}
return 0;


}

miércoles, 6 de noviembre de 2019

Examen

#include <iostream>
#include <stdio.h>
#include <time.h>
#include <windows.h>

using namespace std;

void llv();
void imprvec();
void ordvec();
void imprord();

int vec[20], num1, num2, i, j, n;

int main(){
llv();
imprvec();
ordvec();
imprord();
srand(time(NULL));
system("PAUSE");
return 0;
}

void llv(){

for(int i=0; i<=19; i++){

n=rand()/100;

cin>>vec[i];
}
}

void imprvec(){
for (int i<=0;i<=19;i++){
cout<<vec[i]<<endl;
}
}

void ordvec(){
for(int i=0; i<num1; i++){
    for(int j=0; j<num1-1; j++){
          if (vec[j]>vec[j+1]){
        num2=vec[j];
               vec[j]=vec[j+1];
               vec[j+1]=num2;
           }
       }
   }
}

void imprord(){
for(i=0;i<=19;i++){
cout<<vec[j]<<endl;
}
}

factura

#include <stdlib.h>
 #include <stdio.h>
 #include <iostream>
 #include <windows.h>

 using namespace std;
char cadena[30];
 int cliente,fac,pre1,pre2,pre3,total,iva;
 void captura();
 void operacion();
 void margen();
 void gotoxy(int x, int y)
 {
     HANDLE hcon;
    hcon=GetStdHandle(STD_OUTPUT_HANDLE);
    COORD dwPos;
    dwPos.X=x;
    dwPos.Y=y;
    SetConsoleCursorPosition(hcon,dwPos);
 }

 int main()
 {
    captura();
    operacion();
    margen();
   
     return 0;
 }

 void captura()
 {
     cout <<endl << endl<<"                         DISTRIBUIDORA ALEMAN                         "<<endl;
     cout <<endl<<endl<<"  CLIENTE:  ";
     gets(cadena);
     cout <<endl<<endl<<"  FACTURA:  " ;
     cin >> fac;
     cout << endl <<"  PRECIO 1:  ";
     cin >> pre1;
     cout << endl <<"  PRECIO 2:  ";
     cin >> pre2;
     cout << endl <<"  PRECIO 3:  ";
     cin >> pre3;
 }

 void operacion()
 {
  total=pre1+pre2+pre3;
  cout << endl << endl<<"  El Total es:  " << total << endl;
 
  iva= total*.16;
  cout << endl <<"  El IVA es:  " << iva << endl;
 }

 void margen ()
{

for(int x=1; x<=79; x++)
{
gotoxy (x,0);
putchar ('*');
gotoxy (x,24);
putchar ('*');
}

for(int y=1; y<=24; y++)
{
gotoxy (0,y);
putchar ('*');
gotoxy (79,y);
putchar ('*');
}
}



martes, 5 de noviembre de 2019

Matriz 7

Ejercicio Matriz 7

#include <stdio.h>
#include <iostream>
#include <windows.h>

using namespace std;

void gotoxy(int x,int y){
HANDLE hcon;
hcon=GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwpos;
dwpos.X=x;
dwpos.Y=y;
SetConsoleCursorPosition(hcon, dwpos);
}

void captura();
void suma();
void imprimir();

float mat[5][5],x=5,y=8,n=0;

int main(){
captura();
suma();
imprimir();
}

void captura(){
for(int i=0; i<=3; i++){
for(int j=0; j<=3; j++){
gotoxy(x,y);
cin>>mat[i][j];
x+=5;
}
y+=2;
x=5;
}
}

void suma(){
mat[0][4]=mat[0][0]+mat[0][1]+mat[0][2]+mat[0][3];
mat[0][4]=mat[0][4]/4;
mat[1][4]=mat[1][0]+mat[1][1]+mat[1][2]+mat[1][3];
mat[1][4]=mat[1][4]/4;
mat[2][4]=mat[2][0]+mat[2][1]+mat[2][2]+mat[2][3];
mat[2][4]=mat[2][4]/4;
mat[3][4]=mat[3][0]+mat[3][1]+mat[3][2]+mat[3][3];
mat[3][4]=mat[3][4]/4;
mat[4][0]=mat[0][0]+mat[1][0]+mat[2][0]+mat[3][0];
mat[4][0]=mat[4][0]/4;
mat[4][1]=mat[0][1]+mat[1][1]+mat[2][1]+mat[3][1];
mat[4][1]=mat[4][1]/4;
mat[4][2]=mat[0][2]+mat[1][2]+mat[2][2]+mat[3][2];
mat[4][2]=mat[4][2]/4;
mat[4][3]=mat[0][3]+mat[1][3]+mat[2][3]+mat[3][3];
mat[4][3]=mat[4][3]/4;
mat[4][4]=mat[0][4]+mat[1][4]+mat[2][4]+mat[3][4];
mat[4][4]=mat[4][4]/4;
system("pause");
system("cls");
}

void imprimir(){
for(int i=0; i<=4; i++){
for(int j=0; j<=4; j++){
gotoxy(x,y);
cout<<mat[i][j];
x+=5;
}
y+=2;
x=5;
}
}
















Matriz 6

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>

using namespace std;

void captura();
void operacion();
void imprimir();
char nombre[20], factura[20];
int pr1, pr2, pr3, t, iva, x, y;

void gotoxy(int x, int y){
HANDLE hcon;
hcon=GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwpos;
dwpos.X=x;
dwpos.Y=y;
SetConsoleCursorPosition(hcon,dwpos);
}

int main(){
captura();
operacion();
imprimir(); 
system("PAUSE");
return 0;
}

void captura(){
cout<<"ingrese su nombre"<<endl;
gets (nombre);
cout<<"ingresa el numero de la factura"<<endl;
cin>>factura;
cout<<"ingresa el precio del primer producto"<<endl;
cin>>pr1;
cout<<"ingresa el precio del segundo producto"<<endl;
cin>>pr2;
cout<<"ingresa el precio del tercer producto"<<endl;
cin>>pr3;
}

void operacion(){
t=pr1+pr2+pr3;
iva=t*0.16;
}

void imprimir(){
cout<<""<<endl;
cout<<"EL TOTAL ES:"<<endl;
cout<<t<<endl;
}

Matriz 5

#include <stdio.h>
#include <iostream>
#include <windows.h>

using namespace std;

void captura();
void imprimir();
void imprimetraspuesta();

void gotoxy(int x,int y){
HANDLE hcon;
hcon=GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwpos;
dwpos.X=x;
dwpos.Y=y;
SetConsoleCursorPosition(hcon,dwpos);
}

int matriz[3][4], x=5,y=8;

int main(){
captura();
imprimir();
imprimetraspuesta();
return 0;
}

void captura(){
for(int i=0; i<=2; i++){
for(int j=0; j<=3; j++){
gotoxy(y,x);
cin>>matriz[i][j];
x+=5;
}
y+=2;
x=5;
}
system("pause");
system("cls");
}

void imprimir(){
for(int i=0; i<=2; i++){
for(int j=0; j<=3; j++){
gotoxy(y,x);
cout<<matriz[i][j];
x+=5;
}
y+=2;
x=5;
}
system("pause");
system("cls");
}

void imprimetraspuesta(){
for(int i=0; i<=2; i++){
for(int j=0; j<=3; j++){
gotoxy(x,y);
cout<<matriz[i][j];
x+=5;
}
y+=2;
x=5;
}
}


Matriz 4

#include <stdio.h>
#include <iostream>
#include <windows.h>

using namespace std;

void captura();
void imprimir();

void gotoxy(int x,int y){
HANDLE hcon;
hcon=GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwpos;
dwpos.X=x;
dwpos.Y=y;
SetConsoleCursorPosition(hcon,dwpos);
}

int matriz[4][4], x=5,y=8;

int main(){
captura();
imprimir();
system("pause");
return 0;
}

void captura(){
for(int i=0; i<=3; i++){
for(int j=0; j<=3; j++){
cout<<"Ingrese la calificacion:"<<endl;
cin>>matriz[i][j];
}
}
system("cls");
}

void imprimir(){
for(int i=0; i<=3; i++){
for(int j=0; j<=3; j++){
gotoxy(x,y);
cout<<matriz[i][j];
x+=5;
}
y+=2;
x=5;
}
}









Matriz 3

#include <stdio.h>
#include <iostream>
#include <windows.h>

using namespace std;

void captura();
void imprimir();

void gotoxy(int x,int y){
HANDLE hcon;
hcon=GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwpos;
dwpos.X=x;
dwpos.Y=y;
SetConsoleCursorPosition(hcon,dwpos);
}

int matriz[6][6], x=5,y=8;

int main(){
captura();
imprimir();
system("pause");
return 0;
}

void captura(){
for(int i=0; i<=5; i++){
for(int j=0; j<=5; j++){
cout<<"Ingrese la calificacion:"<<endl;
cin>>matriz[i][j];
}
}
system("cls");
}

void imprimir(){
for(int i=0; i<=5; i++){
for(int j=0; j<=5; j++){
gotoxy(x,y);
cout<<matriz[i][j];
x+=5;
}
y+=2;
x=5;
}
}