Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
me podrian ayudar a corregirlo, necesito que al escribir la letra "s" el programa siga o me diga que "el articulo se encuentra disponible"y siga ejecutandoce.

Translated:
Quote:
they could help me correct it, I need that when writing the letter "s" the program follows or tells me that "the article is available" and continues to execute.


C++
#include<iostream>
#include <stdlib.h>
using namespace std;

int main()
{
 int refe;              //referencia
 char descrip[30];	    //descripcion del zapato
 int talla;             //talla
 char opcion[3];        //esta o no esta disponible 
 int cost;              //costo
 int vent;              //valor de venta

do{
	
cout<<"Ingresa la referencia del zapato:"<< end1;	
cin>>refe;

cout<<"Digite una descripción del zapato"<<end1;
cin.getline(descrip,30);

cout<<"Digite la letra si esta o no disponibe para la venta S/N..."<<end1;
scanf("%s", opcion);

}while (opcion[0] == 's' || opcion[0] == 'S');
cout<<"Digita el costo del zapato"<<end1;
cin>>cost;
cout<<"Digita el precio de venta del zapato..."
cin>>vent;		

system("cls");
cout<<"LOS DATOS REGISTRADOS SON LOS SIGUIENTES /n /n";


cout<<"REFERENCIA"<<refe<<end1;
cout<<"DESCRIPCION"<<descrip<<end1;
cout<<"TALLA"<<talla<<end1;
cout<<"DISPONIBILIDAD"<<opcion<<end1;
cout<<"COSTO"<<cost<<end1;
cout<<"PRECIO"<<vent<<end1;

cout<<"Gracias por digitar la información";

	system("pause") ;
	return EXIT_SUCCESS;
}


What I have tried:

Sofía es estudiante de una carrera técnica en sistemas de computación y requiere
un ingreso extra para amortiguar sus gastos personales. Ella se ha encontrado con una
oportunidad en Internet donde le ofrecen zapatos al por mayor y a un buen precio. Ella
decide desarrollar una aplicación en el lenguaje C++ que le ofrezca realizar cálculos para
determinar costos, margen de ganancias y proyectar sus ventas. En este programa a
desarrollar, desempeñará el rol de compañero (a) y socio (a) de Sofía y le ayudará con su
propósito

Translated:
Quote:
Sofia is a student of a technical career in computer systems and requires
an extra income to cushion your personal expenses. She has encountered a
opportunity on the Internet where they offer you shoes wholesale and at a good price. She
decides to develop an application in the C++ language that offers you to perform calculations for
determine costs, profit margin and project your sales. In this program to
develop, play the role of Sofia's partner and partner and help you with your
purpose
Posted
Updated 11-Oct-21 20:15pm
v2
Comments
Richard MacCutchan 11-Oct-21 15:03pm    
This is an English language site; please translate your question.
Member 15329613 11-Oct-21 16:57pm    
Ingles.

1 solution

A quick fix would be replacing
Quote:
while (opcion[0] == 's' || opcion[0] == 'S');
with
C++
while (opcion[0] != 's' && opcion[0] != 'S');

However, there are still errors, in your program.

A working version of it follows, anyway, you should really user std::string instead of 'array of characters', for your strings.

C++
#include<iostream>
#include <cstdlib>
#include <limits>
using namespace std;

int main()
{
 int refe;              //referencia
 char descrip[30];      //descripcion del zapato
 int talla;             //talla
 char opcion[3];        //esta o no esta disponible 
 int cost;              //costo
 int vent;              //valor de venta

  do
  {

    cout<<"Ingresa la referencia del zapato:"<< endl;
    cin>>refe;
    cin.ignore(numeric_limits<streamsize>::max(),'\n');

    cout<<"Digite una descripción del zapato"<<endl;
    cin.getline(descrip,30);
    cout<<"Digite la letra si esta o no disponibe para la venta S/N..."<<endl;
    cin >> opcion;
    cout << "'" << opcion << "'" << endl;

  } while (opcion[0] != 's' && opcion[0] != 'S');
  cout<<"Digita el costo del zapato"<<endl;
  cin>>cost;
  cout<<"Digita el precio de venta del zapato...";
  cin>>vent;

  system("cls");
  cout<<"LOS DATOS REGISTRADOS SON LOS SIGUIENTES /n /n";


  cout<<"REFERENCIA"<<refe<<endl;
  cout<<"DESCRIPCION"<<descrip<<endl;
  cout<<"TALLA"<<talla<<endl;
  cout<<"DISPONIBILIDAD"<<opcion<<endl;
  cout<<"COSTO"<<cost<<endl;
  cout<<"PRECIO"<<vent<<endl;

  cout<<"Gracias por digitar la información";

  system("pause") ;
  return EXIT_SUCCESS;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900