PC Review


Reply
Thread Tools Rate Thread

this is a programing that caloculate the sale of a weak.requirereading in the sale number and the sale of a day>but the result isn't whatwhat I want >help me find the logical error

 
 
493245744@qq.com
Guest
Posts: n/a
 
      1st Nov 2008
#include<stdio.h>
main()
{
int salenumber,quantity;
int quantity1=0,quantity2=0,quantity3=0,quantity4=0,quantity5=0;
double price1,price2,price3,price4,price5;

printf("enter the salenumber and the quantity\n");

while((salenumber=getchar())!=EOF)
{
scanf("%d",&quantity);

switch(salenumber){
case 1:
quantity1+=quantity;
break;

case 2:
quantity2+=quantity;
break;

case 3:
quantity3+=quantity;
break;

case 4:
quantity4+=quantity;
break;

case 5:
quantity5+=quantity;
break;

case '\n':
case '\t':
case ' ' :
break;

default:
printf("enter a worry salenumber.");
printf("enter a new salenumber\n");


}
}
price1=2.98*quantity1;
price2=4.50*quantity2;
price3=9.98*quantity3;
price4=4.49*quantity4;
price5=6.87*quantity5;

printf("price1=%f,price2=%f,price3=%f,price4=%f,price5=
%f",price1,price2,
price3,price4,price5
);

system("pause");

return 0;

}
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Logical vs. Conditional Logical Operators in C# Jonathan Microsoft C# .NET 10 6th May 2006 12:19 AM
several logical partitions or several mounted logical partitions? =?Utf-8?B?MmRvZ3M=?= Windows XP General 6 4th Oct 2005 12:19 PM
several logical partitions or several mounted logical partitions =?Utf-8?B?MmRvZ3M=?= Windows XP Basics 6 3rd Oct 2005 11:35 PM
several logical partitions or several mounted logical partitions =?Utf-8?B?MmRvZ3M=?= Windows XP New Users 3 3rd Oct 2005 11:10 PM
several logical partitions or several mounted logical partitions =?Utf-8?B?MmRvZ3M=?= Windows XP Setup 5 3rd Oct 2005 06:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:00 PM.