hi ppl,
im havin a problem with a while loop.
it just doesnt go out of it, it has the end, but doesnt use it :S

the program is attached :P

// ventas_por_correo.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>


int main(int argc, char* argv[])
{
	using namespace std;

	char producto;
	int cantidad_vendida;
	float precio_total, total_de_ventas = 0;

	cout << "  Ingrese producto a ingresar: " << "\n";
	cout << "     1 - Producto 1" << "\n";
	cout << "     2 - Producto 2" << "\n";
	cout << "     3 - Producto 3" << "\n";
	cout << "     4 - Producto 5" << "\n";
	cout << "     5 - Producto 6" << "\n";
	cout << "  6 - SALIR" << "\n";               // used to go out
	cin >> producto;
	cout << "\n" << "\n";

	while (producto != 6)      // condition
	{
		cout << " Ingrese cantidad de ventas del producto: ";
		cin >> cantidad_vendida;

		switch (producto)
		{
			case '1':
				precio_total = cantidad_vendida * 20.98;
				break;
			case '2':
				precio_total = cantidad_vendida * 41.50;
				break;
			case '3':
				precio_total = cantidad_vendida * 9.98;
				break;
			case '4':
				precio_total = cantidad_vendida * 45.49;
				break;
			case '5':
				precio_total = cantidad_vendida * 16.87;
		}

		cout << "  Ingrese producto a ingresar: " << "\n";
		cout << "     1 - Producto 1" << "\n";
		cout << "     2 - Producto 2" << "\n";
		cout << "     3 - Producto 3" << "\n";
		cout << "     4 - Producto 5" << "\n";
		cout << "     5 - Producto 6" << "\n";
		cout << "  6 - SALIR" << "\n";
		cin >> producto;
		cout << "\n" << "\n";
	}    // end of while loop

	total_de_ventas += precio_total;

	cout << " El total de ventas de la semana es  " << total_de_ventas << "\n" << "\n";
	 


	system ("PAUSE");
	return 0;
}

thnks!!

Olvidaste poner conullas al seis. while (producto != '6') :$

Hope this helps.

commented: Showoff! :) +5

Olvidaste poner conullas al seis. while (producto != '6') :$

Hope this helps.

Positive rep for Duoas, negative rep to Babblefish on this. Babblefish translation:

"You forgot to put conullas to the six."

Apparently "conullas" isn't in the Babblefish dictionary, but Duoas got it right: "quotation marks".

thnks!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.