hola, estado tratando de realiza un programa donde el cliente tiene que mencionar que tipo de hamburguesa quiere (sencilla, doble,triple), tiene que decir cuantas quiere y si pagara en efectivo o con tarjeta (si paga con tarjeta se le hara un cargo del 5% a su compra. y mi codigo es el siguiente (lo realice en visual studio 2015) :
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
int main()
{
int hamc,coshs;
float costc;
char tipoh[12],tipop[4];
printf("EL NAUFRAGO SATISFECHO\n\n");
printf("Ingresar las Hamburguesas a comprar\n");
scanf_s("%d",&hamc);
printf("ingresar el tipo de hamburguesa\n");
gets_s(tipoh);
printf("El pago sera en efectivo");
gets_s(tipop);
if (tipop = 'no')
{
if (tipoh = 'sencilla')
{
coshs = 20 * hamc;
costc = coshs + (coshs*.05);
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", costc);
}
else if (tipoh = 'doble')
{
coshs = 25 * hamc;
costc = coshs + (coshs*.05);
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", costc);
}
else if (tipoh = 'triple')
{
coshs = 28 * hamc;
costc = coshs + (coshs*.05);
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", costc);
}
}
else
{
if (tipoh = 'sencilla')
{
coshs = 20 * hamc;;
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", coshs);
}
else if (tipoh = 'doble')
{
coshs = 25 * hamc;
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", coshs);
}
else if (tipoh = 'triple')
{
coshs = 28 * hamc;
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", coshs);
}
}
system("pause");
}
Mi problema es que no me reconoce la comparación, espero que alguien me pueda ayudar con mi problema, gracias.
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
int main()
{
int hamc,coshs;
float costc;
char tipoh[12],tipop[4];
printf("EL NAUFRAGO SATISFECHO\n\n");
printf("Ingresar las Hamburguesas a comprar\n");
scanf_s("%d",&hamc);
printf("ingresar el tipo de hamburguesa\n");
gets_s(tipoh);
printf("El pago sera en efectivo");
gets_s(tipop);
if (tipop = 'no')
{
if (tipoh = 'sencilla')
{
coshs = 20 * hamc;
costc = coshs + (coshs*.05);
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", costc);
}
else if (tipoh = 'doble')
{
coshs = 25 * hamc;
costc = coshs + (coshs*.05);
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", costc);
}
else if (tipoh = 'triple')
{
coshs = 28 * hamc;
costc = coshs + (coshs*.05);
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", costc);
}
}
else
{
if (tipoh = 'sencilla')
{
coshs = 20 * hamc;;
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", coshs);
}
else if (tipoh = 'doble')
{
coshs = 25 * hamc;
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", coshs);
}
else if (tipoh = 'triple')
{
coshs = 28 * hamc;
printf("PEDIDO: %d hambuergesa´s %s \n", hamc, tipoh);
printf("Total a pagar es: %f\n", coshs);
}
}
system("pause");
}
Mi problema es que no me reconoce la comparación, espero que alguien me pueda ayudar con mi problema, gracias.