Advertisement

02.16.2006 at 05:23PM PST, ID: 21740363
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

C language: character constant must be one or two character long!!!

Asked by toilatoi in Miscellaneous Programming

Tags: , , , ,

I am doing my assignment and i receive some error when compile my program, can you help me !
This is my assignment and my program.

PROBLEM SPECIFICATION
DESCRIPTION
You have been hired  to write a book catalogue program. The
program is required to maintain details of book deliveries. The input details
required for each delivery are the delivery name (“END” to stop processing) and
the book details. The book details to be entered are catalogue number, category of
book and cost of book. The program is to keep arrays of the book details:
catalogue number, category of book and cost of book and update some statistics.
Processing of a delivery should stop when a catalogue number of 0 is entered.
On exit, a report is to be output showing the book details grouped as fiction and
non-fiction and the total number of fiction and non-fiction books.
INPUTS
For each delivery enter the:
Delivery Name: The company name of the delivery (max 20 character
string). A delivery name of “END” will stop processing.
Input from the keyboard. Validation is not required.
For each book enter the:
Catalogue Number: The catalogue number of the book (0-9999). Input from the
keyboard. Must be validated.
Book Category: Books are grouped into categories of fiction (F) or nonfiction
(N). Input from the keyboard. Must be validated.
Book Cost: The cost of the book (positive real number). Input from the
keyboard. Must be validated.
PROCESSING
For each delivery
1. Input the Delivery Name.
2. Input and validate the Catalogue number, book category and cost for each
book.
3. Update statistics.
4. Update the arrays.
5. On termination of the delivery, output the delivery details
After all deliveries have been entered:
Output a report showing the book details catalogue number and cost of book
for fiction and non-fiction books.
OUTPUTS
After a delivery has been entered, output the following details:
Total number of books for that delivery.
Total value of books for that delivery.
After all deliveries have been entered output a report to display the book details
grouped into categories of fiction and non-fiction:
FICTION BOOKS
Catalogue Number Cost of book
------ ------------------------------------
Total number of fiction books
NON-FICTION BOOKS
Catalogue Number Cost of book
------ ------------------------------------
Total number of non-fiction books
All output must go to the screen.

***********************************************************************************
***********************************************************************************

 #include <stdio.h>
 #include <conio.h>

 #define MAX 20


 char InputDelivery()
 {
      char Delivery;

      printf("Please enter the Delivery Name: ");
      scanf("%c",&Delivery);
      return Delivery;
 }
 int InputCatalogNo()
 {
      int CatalogNo = 0;

      printf("Please enter the Catalogue Number: ");
      scanf("%i",&CatalogNo);
      while(CatalogNo < 1 || CatalogNo > 9999)
      {
            printf("Please enter the Catalogue Number ( 1 to 9999): ");
            scanf("%i",&CatalogNo);
      }
      return CatalogNo;
 }
 char InputCategory()
 {
      char Category;

      printf("Please enter the Category(F for fiction or N for non-fiction): ");
      scanf("%c",&Category);
      while(Category != 'F' && Category != 'N')
      {
             printf("Please enter the Category(fiction or non-fiction): ");
             scanf("%c",&Category);
      }
      return Category;

 }
 float InputCost()
 {
      float Cost = 0;

      printf("Please enter the Cost: ");
      scanf("%f",&Cost);
      while(Cost < 0)
      {
            printf("Please enter the Cost: ");
            scanf("%f",&Cost);
      }
      return Cost;
 }
 void OutputDetail(char Delivery,int CatalogNo,char Category,float Cost)
 {
      printf("Details for Delivery %c is: %i, %c, %f",Delivery,CatalogNo,Category,Cost);
 }
 void OutputAll(int CatalogNoArrFic[],int CatalogNoArrNon[],int CategoryFic,int CategoryNon,float CostArrFic[],float CostArrNon[])
 {      int i = 0;
      int j = 0;
      for(i= 0;i < MAX;i ++)
      {
      printf("Fiction Book:\n   Catalogue No   Book Cost\n     %i           %f",CatalogNoArrFic[i],CostArrFic[i]);
      printf("Total number Fiction books is %i",CategoryFic);
      }
      for(j = 0;j < MAX;j ++)
      {
      printf("Non-Fiction Book:\n   Catalogue No    Book Cost\n       %i      %f",CatalogNoArrNon[j],CostArrNon[j]);
      printf("Total number Non-fiction books is %i",CategoryNon);
      }

 }

 int main(void)
 {
      int CatalogNoArrFic[MAX] = {0};
      int CatalogNoArrNon[MAX] = {0};
      int CategoryFic = 0;
      int CategoryNon = 0;
      float CostArrFic[MAX] = {0};
      float CostArrNon[MAX] = {0};
      char Delivery;
      int CatalogNo = 0;
      char Category;
      float Cost = 0;

      clrscr();

      do
      {
      Delivery = InputDelivery();
      while(Delivery != 0)
      {
            CatalogNo = InputCatalogNo();
            Cost = InputCost();
            Category = InputCategory();
            switch(Category)
            {
                  case 'F': for(int a = 0;a < MAX;a++)
                          {
                              CatalogNo = CatalogNoArrFic[a];
                              Cost = CostArrFic[a];
                              CategoryFic ++;
                          }
                          break;
                  case 'N': for(int b = 0;b < MAX;b++)
                          {
                              CatalogNo = CatalogNoArrNon[a];
                              Cost = CostArrNon[a];
                              CategoryNon ++;
                          }
            }
            OutputDetail(Delivery,CatalogNo,Category,Cost);
            Delivery = InputDelivery();
      }

      }
      while(Delivery != 'End');

      OutputAll(CatalogNoArrFic,CatalogNoArrNon,CategoryFic,CategoryNon,CostArrFic,CostArrNon);
      getch();
        return 0;
 }
**********************************************************************************
**********************************************************************************Start Free Trial
 
Keywords: C language: character constant must …
 
Loading Advertisement...
 
[+][-]02.16.2006 at 05:38PM PST, ID: 15977280

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.17.2006 at 01:31AM PST, ID: 15978825

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.17.2006 at 04:49AM PST, ID: 15980050

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Miscellaneous Programming
Tags: constant, must, one, catalogue, character
Sign Up Now!
Solution Provided By: bytta
Participating Experts: 3
Solution Grade: B
 
 
[+][-]02.17.2006 at 05:14AM PST, ID: 15980234

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32