Skip to content

Instantly share code, notes, and snippets.

@ahoulgrave
Created April 17, 2013 13:46
Show Gist options
  • Save ahoulgrave/5404441 to your computer and use it in GitHub Desktop.
Save ahoulgrave/5404441 to your computer and use it in GitHub Desktop.
printf Carnicería
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
int main(int argc, char *argv[])
{
int ancho = 15;
char s_Corte1[50];
char s_Corte2[50];
char s_Corte3[50];
char s_Corte4[50];
char s_Corte5[50];
char s_Corte6[50];
char s_Corte7[50];
float f_Corte1 = 0.00;
float f_Corte2 = 0.00;
float f_Corte3 = 0.00;
float f_Corte4 = 0.00;
float f_Corte5 = 0.00;
float f_Corte6 = 0.00;
float f_Corte7 = 0.00;
printf("Ingrese el corte 1: \n");
scanf("%s",&s_Corte1);
printf("Ingrese el precio para el corte 1: \n");
scanf("%f",&f_Corte1);
printf("Ingrese el corte 2: \n");
scanf("%s",&s_Corte2);
printf("Ingrese el precio para el corte 2: \n");
scanf("%f",&f_Corte2);
printf("Ingrese el corte 3: \n");
scanf("%s",&s_Corte3);
printf("Ingrese el precio para el corte 3: \n");
scanf("%f",&f_Corte3);
printf("Ingrese el corte 4: \n");
scanf("%s",&s_Corte4);
printf("Ingrese el precio para el corte 4: \n");
scanf("%f",&f_Corte4);
printf("Ingrese el corte 5: \n");
scanf("%s",&s_Corte5);
printf("Ingrese el precio para el corte 5: \n");
scanf("%f",&f_Corte5);
printf("Ingrese el corte 6: \n");
scanf("%s",&s_Corte6);
printf("Ingrese el precio para el corte 6: \n");
scanf("%f",&f_Corte6);
printf("Ingrese el corte 7: \n");
scanf("%s",&s_Corte7);
printf("Ingrese el precio para el corte 7: \n");
scanf("%f",&f_Corte7);
printf("\n");
printf("\n");
printf("-----------------------------------");
printf("\n");
cout << setw(ancho);
cout << s_Corte1;
cout << setw(ancho);
cout << f_Corte1 << endl;
cout << setw(ancho);
cout << s_Corte2;
cout << setw(ancho);
cout << f_Corte2 << endl;
cout << setw(ancho);
cout << s_Corte3;
cout << setw(ancho);
cout << f_Corte3 << endl;
cout << setw(ancho);
cout << s_Corte4;
cout << setw(ancho);
cout << f_Corte4 << endl;
cout << setw(ancho);
cout << s_Corte5;
cout << setw(ancho);
cout << f_Corte5 << endl;
cout << setw(ancho);
cout << s_Corte6;
cout << setw(ancho);
cout << f_Corte6 << endl;
cout << setw(ancho);
cout << s_Corte7;
cout << setw(ancho);
cout << f_Corte7 << endl;
printf("\n");
printf("\n");
printf("-----------------------------------");
printf("\n");
printf("\n");
system("PAUSE");
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment