473,387 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

#include<stdio.h>
main()
{
int salenumber,quantity;
int quantity1=0,quantity2=0,quantity3=0,quantity4=0,qu antity5=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,pr ice5=
%f",price1,price2,
price3,price4,price5
);

system("pause");

return 0;

}
Nov 1 '08 #1
0 822

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Christopher Weaver | last post by:
I've written a function that is intended to modify some of the properties of whatever form is to it. The function, declared within frmTasks, looks like this public void FormActivated(Form...
7
by: Drew Berkemeyer | last post by:
I've encounted a pretty strange problem and I'm not quite sure what to make of it. I have a web service that consumes an XML file as well as a few other parameters. This web service works fine...
1
by: TC | last post by:
Anyone know what this means Parser Error Message: Error loading XML file E:\Inetpub\wwwroot\web.config Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks. Parameter name:...
3
by: Steven C. | last post by:
I'm trying to learn C#, and I came across the following: bool isClickInCell = hti.Column == this._columnNum && hti.Row > -1; What exactly is going on here? As a Foxpro dude, this totally...
9
by: Michael A. Covington | last post by:
C# won't let me do something elegant. I'm creating a class and want to give it "write to file" and "read from file" methods. I'm actually using the XML serializer, but that's not the problem. ...
11
by: Joseph S. | last post by:
Hi all, how do I avoid typing the keyword "$this->" every time I need to reference a member of a class inside the class? (coming from a world of cozy auto-complete enabled Java / .Net IDEs I...
0
by: Gregory Gadow | last post by:
We have a number of development machines in our IT department, all running the same version of VS 2005 sp 1. Our company website and several compiled components were all written in VB.Net 2.0 using...
1
by: Nilam2477 | last post by:
I have application developed in VC/COM/DCOM At some point of time i got the following error message and application closed. Faulting application <application name>, version <version number>,...
1
by: Jeff | last post by:
I'm getting this error: Parse error: syntax error, unexpected '-', expecting ']' when I try to do this: $my_here_doc = <<<my_heredoc $x my_heredoc;
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.