For the half of you that whine and complain that the new people don't use code tags please do not respond to me but for the people that did a great job helping me before:

I was asked how to use code tags and i am sorry but this is what I got

you mean

// your code here

The only thing I could come up with is the # sign at the top for code and the tex button at the top for comments and non code related if this is right let me know and if not can you please explain it just a little better so I can make my questions easier for you guys since your the ones helping us.

Recommended Answers

All 10 Replies

Code tags:

[code=c++] // your code goes here

[/code]
I always manually type in the code tags you see above. I only takes a second or two to get great looking results.

Im still not explained by an example but hope this works

//Name: Bryan Kruep
//Class: CS 140-001
//Assignment: Lab 2
//Date: 01/22/08
#include <iostream>
#include <string>
using namespace std;
const double TACO_COST = 0.49;   
const double HOTDOG_COST = 0.75;
const double DRINKS_COST = 0.99;
const double SOURCREAM_COST = 0.15;
const double TAX_RATE = 0.0725;
int sum = 0;
int main ()
{

	int hotdogquantity = 0, tacoquantity = 0, sourcreamquantity = 0, drinkquantity = 0;
	double hotdogs_total_cost, tacos_total_cost, tacos_with_sourcream_total_cost, drinks_total_cost, subtotal, taxes, total_cost;
	char ans;

	cout << endl << "Programmed By: Bryan Kruep \n" <<endl;

	cout.setf(ios::fixed);
	cout.setf(ios::showpoint);
	cout.precision(2);

	do
	{

	if (hotdogquantity >= 0)
{
	cout << "Number of Hotdogs: ";
	cin >> hotdogquantity;
}

while (hotdogquantity < 0)
{
	
cout << "Number of hotdogs cannot be a negative number!! Try again: ";
cin >> hotdogquantity;
}

if (tacoquantity >= 0)
{

	cout << "Number of Tacos: ";
	cin >> tacoquantity;
}

while (tacoquantity < 0)
{
cout << "Number of tacos cannot be a negative number!! Try again: ";
cin >> tacoquantity;
}

if (sourcreamquantity < tacoquantity)
{
	cout << "How many of those tacos with sour cream: ";
	cin >> sourcreamquantity;
}

while (sourcreamquantity > tacoquantity || sourcreamquantity < 0)
{

cout << "Can't have more tacos with sourcream than the number of tacos ordered. Number of sour creams cannot be a negative. Try again!: ";
cin >> sourcreamquantity;
}



if (drinkquantity >= 0)
{
	cout << "Number of drinks: ";
	cin >> drinkquantity;
}
while (drinkquantity < 0)
{
cout << "Number of drinks cannot be a negative number!! Try again: ";
cin >> drinkquantity;
}



	cout << endl << endl << endl << "BILL";
	cout << endl << "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _";
    
	cout << endl << "\t" << hotdogquantity << " Hotdogs"; 
	cout << endl << "\t" << tacoquantity << " Tacos" << " - " << sourcreamquantity << " with sour cream";
	cout << endl << "\t" << drinkquantity << " Drinks";
	
	//Calculate totals
	hotdogs_total_cost = hotdogquantity * HOTDOG_COST;
	tacos_total_cost = tacoquantity * TACO_COST;
	tacos_with_sourcream_total_cost = sourcreamquantity * SOURCREAM_COST;
	drinks_total_cost = drinkquantity * DRINKS_COST;
	subtotal = hotdogs_total_cost + tacos_total_cost + tacos_with_sourcream_total_cost + drinks_total_cost;
	taxes = subtotal * TAX_RATE;
	total_cost = subtotal + taxes;

	//Display output

	cout << endl << endl << "Subtotal: " << subtotal;
	cout << endl << "Taxes: " << taxes;
	cout << endl << "Total: " << total_cost;
	cout << endl;
	

		sum = 0 ;
		cout << "Another order? (Y/N)";
		cin >> ans;
		cout << endl << endl;

 }while ( (ans != 'n') && (ans != 'N') );
	
return 0;
}
// your code goes here

//Name: Bryan Kruep
//Class: CS 140-001
//Assignment: Lab 2
//Date: 01/22/08
#include <iostream>
#include <string>
using namespace std;
const double TACO_COST = 0.49;
const double HOTDOG_COST = 0.75;
const double DRINKS_COST = 0.99;
const double SOURCREAM_COST = 0.15;
const double TAX_RATE = 0.0725;
int sum = 0;
int main ()
{

int hotdogquantity = 0, tacoquantity = 0, sourcreamquantity = 0, drinkquantity = 0;
double hotdogs_total_cost, tacos_total_cost, tacos_with_sourcream_total_cost, drinks_total_cost, subtotal, taxes, total_cost;
char ans;

cout << endl << "Programmed By: Bryan Kruep \n" <<endl;

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

do
{

if (hotdogquantity >= 0)
{
cout << "Number of Hotdogs: ";
cin >> hotdogquantity;
}

while (hotdogquantity < 0)
{

cout << "Number of hotdogs cannot be a negative number!! Try again: ";
cin >> hotdogquantity;
}

if (tacoquantity >= 0)
{

cout << "Number of Tacos: ";
cin >> tacoquantity;
}

while (tacoquantity < 0)
{
cout << "Number of tacos cannot be a negative number!! Try again: ";
cin >> tacoquantity;
}

if (sourcreamquantity < tacoquantity)
{
cout << "How many of those tacos with sour cream: ";
cin >> sourcreamquantity;
}

while (sourcreamquantity > tacoquantity || sourcreamquantity < 0)
{

cout << "Can't have more tacos with sourcream than the number of tacos ordered. Number of sour creams cannot be a negative. Try again!: ";
cin >> sourcreamquantity;
}

if (drinkquantity >= 0)
{
cout << "Number of drinks: ";
cin >> drinkquantity;
}
while (drinkquantity < 0)
{
cout << "Number of drinks cannot be a negative number!! Try again: ";
cin >> drinkquantity;
}

cout << endl << endl << endl << "BILL";
cout << endl << "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _";

cout << endl << "\t" << hotdogquantity << " Hotdogs";
cout << endl << "\t" << tacoquantity << " Tacos" << " - " << sourcreamquantity << " with sour cream";
cout << endl << "\t" << drinkquantity << " Drinks";

//Calculate totals
hotdogs_total_cost = hotdogquantity * HOTDOG_COST;
tacos_total_cost = tacoquantity * TACO_COST;
tacos_with_sourcream_total_cost = sourcreamquantity * SOURCREAM_COST;
drinks_total_cost = drinkquantity * DRINKS_COST;
subtotal = hotdogs_total_cost + tacos_total_cost + tacos_with_sourcream_total_cost + drinks_total_cost;
taxes = subtotal * TAX_RATE;
total_cost = subtotal + taxes;

//Display output

cout << endl << endl << "Subtotal: " << subtotal;
cout << endl << "Taxes: " << taxes;
cout << endl << "Total: " << total_cost;
cout << endl;


sum = 0 ;
cout << "Another order? (Y/N)";
cin >> ans;
cout << endl << endl;

}while ( (ans != 'n') && (ans != 'N') );

return 0;
}

Jim: Do NOT use ICODE or TXT tags -- do it exactly as I illustrated in my previous post. NO OTHER TAGS PERMITTED. I removed those two tags from your post.

//Name: Bryan Kruep
//Class: CS 140-001
//Assignment: Lab 2
//Date: 01/22/08
#include <iostream>
#include <string>
using namespace std;
const double TACO_COST = 0.49;   
const double HOTDOG_COST = 0.75;
const double DRINKS_COST = 0.99;
const double SOURCREAM_COST = 0.15;
const double TAX_RATE = 0.0725;
int sum = 0;
int main ()
{

	int hotdogquantity = 0, tacoquantity = 0, sourcreamquantity = 0, drinkquantity = 0;
	double hotdogs_total_cost, tacos_total_cost, tacos_with_sourcream_total_cost, drinks_total_cost, subtotal, taxes, total_cost;
	char ans;

	cout << endl << "Programmed By: Bryan Kruep \n" <<endl;

	cout.setf(ios::fixed);
	cout.setf(ios::showpoint);
	cout.precision(2);

	do
	{

	if (hotdogquantity >= 0)
{
	cout << "Number of Hotdogs: ";
	cin >> hotdogquantity;
}

while (hotdogquantity < 0)
{
	
cout << "Number of hotdogs cannot be a negative number!! Try again: ";
cin >> hotdogquantity;
}

if (tacoquantity >= 0)
{

	cout << "Number of Tacos: ";
	cin >> tacoquantity;
}

while (tacoquantity < 0)
{
cout << "Number of tacos cannot be a negative number!! Try again: ";
cin >> tacoquantity;
}

if (sourcreamquantity < tacoquantity)
{
	cout << "How many of those tacos with sour cream: ";
	cin >> sourcreamquantity;
}

while (sourcreamquantity > tacoquantity || sourcreamquantity < 0)
{

cout << "Can't have more tacos with sourcream than the number of tacos ordered. Number of sour creams cannot be a negative. Try again!: ";
cin >> sourcreamquantity;
}



if (drinkquantity >= 0)
{
	cout << "Number of drinks: ";
	cin >> drinkquantity;
}
while (drinkquantity < 0)
{
cout << "Number of drinks cannot be a negative number!! Try again: ";
cin >> drinkquantity;
}



	cout << endl << endl << endl << "BILL";
	cout << endl << "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _";
    
	cout << endl << "\t" << hotdogquantity << " Hotdogs"; 
	cout << endl << "\t" << tacoquantity << " Tacos" << " - " << sourcreamquantity << " with sour cream";
	cout << endl << "\t" << drinkquantity << " Drinks";
	
	//Calculate totals
	hotdogs_total_cost = hotdogquantity * HOTDOG_COST;
	tacos_total_cost = tacoquantity * TACO_COST;
	tacos_with_sourcream_total_cost = sourcreamquantity * SOURCREAM_COST;
	drinks_total_cost = drinkquantity * DRINKS_COST;
	subtotal = hotdogs_total_cost + tacos_total_cost + tacos_with_sourcream_total_cost + drinks_total_cost;
	taxes = subtotal * TAX_RATE;
	total_cost = subtotal + taxes;

	//Display output

	cout << endl << endl << "Subtotal: " << subtotal;
	cout << endl << "Taxes: " << taxes;
	cout << endl << "Total: " << total_cost;
	cout << endl;
	

		sum = 0 ;
		cout << "Another order? (Y/N)";
		cin >> ans;
		cout << endl << endl;

 }while ( (ans != 'n') && (ans != 'N') );
	
return 0;
}

ok i think i got it wow i made that harder than it looked...ok my only problem is one last thing....when I try to run it everything is fine but one thing...after i click 'y' and it starts back at hotdogs it seems the input is still saved from the previous bill so when I click tacos it automatically compares sour cream to the previous bill if that makes sense

did i make it easier for you to help now

before finishing the loop you have to reinitialize all variables back to their original values so that doesn't happen.

After 23 posts, did you ever notice there were words on the background of the textbox you enter all your posts? They also explain CODE tags. So do various threads at the top of the forums, and the Rules.

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.