troubleshooting Question

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

Avatar of toilatoi
toilatoi asked on
Programming
4 Comments1 Solution4064 ViewsLast Modified:
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;
 }
**********************************************************************************
**********************************************************************************
ASKER CERTIFIED SOLUTION
bytta

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros