Still puzzled

This is a discussion on Still puzzled within the C Programming forums, part of the General Programming Boards category; Here is the whole program that I am working on: code _________________________________________________ #include <stdio.h> #include <string.h> #define NAME_SIZE 26 #define ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    35

    Unhappy Still puzzled

    Here is the whole program that I am working on:

    code
    _________________________________________________
    #include <stdio.h>
    #include <string.h>
    #define NAME_SIZE 26
    #define ADDRESS_SIZE 26
    #define CITY_STATE_ZIP_SIZE 26
    #define PHONENO_SIZE 16
    void PrintHeadings(void);
    void GetTopLine(void);
    void Calculate(void);
    void CalcInstall(void);
    void CalcSubTotal(void);
    void CalcTotal(void);
    void PrintResults(void);
    void Termination(void);
    void GetTopLine(void);
    void HorizontalLine(void);
    void GetBottomLine(void);
    void lengthWidthArea(char CustomerName[NAME_SIZE], char CustomerAddress[ADDRESS_SIZE],
    char CityStateZip[CITY_STATE_ZIP_SIZE], char CustomerPhoneNo[PHONENO_SIZE], int *length, int *width);
    int PageNo = 1;
    int initialization(char CustomerName[NAME_SIZE], char CustomerAddress[ADDRESS_SIZE],
    char CityStateZip[CITY_STATE_ZIP_SIZE], char CustomerPhoneNo[PHONENO_SIZE], int *length, int *width);
    int processCustomerRecord(char CustomerName[NAME_SIZE], char CustomerAddress[ADDRESS_SIZE],
    char CityStateZip[CITY_STATE_ZIP_SIZE], char CustomerPhoneNo[PHONENO_SIZE], int *length, int *width);
    int calculateLengthWidth( int *length, int *width);
    void termination(void);
    int main(void)
    {
    char CustomerName[NAME_SIZE] = {0};
    char CustomerAddress[ADDRESS_SIZE] = {0};
    char CityStateZip[CITY_STATE_ZIP_SIZE] = {0};
    char CustomerPhoneNo[PHONENO_SIZE] = {0};
    int calculateLengthWidth( int *length, int *width);
    int length;
    int width;

    //int plength = &length;
    int readStatus = 0;

    readStatus = initialization( CustomerName, CustomerAddress,
    CityStateZip, CustomerPhoneNo, &length, &width);
    while ( 6 == readStatus )
    {
    readStatus = processCustomerRecord ( CustomerName, CustomerAddress,
    CityStateZip, CustomerPhoneNo, &length, &width);
    }
    termination();
    return 0;
    }
    // This is where the prime read is
    int initialization(char CustomerName[NAME_SIZE], char CustomerAddress[ADDRESS_SIZE],
    char CityStateZip[CITY_STATE_ZIP_SIZE], char CustomerPhoneNo[PHONENO_SIZE], int *length, int *width)
    {
    int status;
    GetTopLine();
    PrintHeadings();
    status = scanf("%25c %25c %25c %15c %i %i", CustomerName, CustomerAddress, CityStateZip,
    CustomerPhoneNo, length, width);

    return status;
    }
    void GetTopLine(void)
    {
    int tLine = 0;
    printf("%c", 218);
    for(tLine = 0; tLine < 78; tLine++)
    {
    printf("%c", 196);
    }
    printf("%c\n", 191);
    }
    void HorizontalLine(void)
    {
    int hLine = 0;
    for(hLine = 0; hLine < 78; hLine++)
    {
    printf("%c", 196);
    }
    }
    void GetBottomLine(void)
    {
    int bLine = 0;
    printf("%c", 192);
    for(bLine = 0; bLine < 78; bLine++)
    {
    printf("%c", 196);
    }
    printf("%c", 217);
    }
    void PrintHeadings(void)
    {
    int pageNo = 0;
    pageNo++;
    printf("%c", 179);
    printf("Program Name: PA14.exe");
    printf("%15s By Tommy Hicks %10s", "", "");
    printf("Page No %3d", &pageNo);
    printf("%c\n", 179);
    printf("%c", 179);
    printf("Run Date: 08/22/2001 %57s", "");
    printf("%c\n", 179);
    printf("%c", 195);
    HorizontalLine();
    printf("%c\n", 180);

    }

    // This is where the Customer record is written and printed
    int processCustomerRecord(char CustomerName[NAME_SIZE], char CustomerAddress[ADDRESS_SIZE],
    char CityStateZip[CITY_STATE_ZIP_SIZE], char CustomerPhoneNo[PHONENO_SIZE], int *length, int *width)
    {
    int status;
    //int area = 0;//calculateLengthWidth(*length, *width);
    int area = *length * *width;
    char ch;
    printf("%c", 179);
    printf("%25s %51s %c\n", CustomerName, "", 179);
    printf("%c %25s %50s %c\n", 179, CustomerAddress, "", 179);
    printf("%c %25s %50s %c\n", 179, CityStateZip, "", 179);
    printf("%c %15s %60s %c\n", 179, CustomerPhoneNo, "", 179);
    printf("%c", 195);
    HorizontalLine();
    printf("%c\n", 180);
    //status = scanf("%25c %25c %25c %15c %i %i", CustomerName, CustomerAddress, CityStateZip,
    // CustomerPhoneNo, length, width);
    ch = getchar();
    //printf("%c\n", 179);
    printf("%c", 179);
    printf("%37s MEASUREMENT %28s", "", "");
    printf("%c\n", 179);
    printf("%c %76s %c\n", 179, "", 179);
    printf("%c %25s Length %20s %d ft %15s %c\n", 179, "", "", *length, "", 179);
    printf("%c %25s Width %21s %d ft %15s %c\n", 179, "", "", *width, "", 179);
    int area = calculateLengthWidth(*length, *width);
    status = scanf("%25c %25c %25c %15c %i %i", CustomerName, CustomerAddress, CityStateZip,
    CustomerPhoneNo, length, width);
    return status;
    }//End of processCustomerRecord

    int calculateLengthWidth(int *length, int *width)
    (
    int area = *length * *width;
    printf("%c %25s Area %21s %d ft %15s %c\n", 179, "", "", *area, "", 179);
    return area;
    }//end calculateLengthWidth

    At this moment I have 15 errors and I know it is because of area.

    I'm not sure if it is how it is declared or how I am calling it.

    My stupity continues........
    Imagination at Work

  2. #2
    Unregistered
    Guest
    You'll get a better response if you use the code tags to format your code so that it has the same indention as it does on your compiler like so:
    Code:
    this is code
          i can format it any way i like
      isn't
          this
             fun?
    just type the word code at the beginning of your code and put it in between [] square blocks, then at the end type /code and put it in square blocks and you've got formatting!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Puzzled.
    By silhoutte75 in forum C Programming
    Replies: 13
    Last Post: 01-21-2008, 05:17 PM
  2. Replies: 4
    Last Post: 07-15-2005, 05:10 PM
  3. Puzzled
    By fkheng in forum C Programming
    Replies: 5
    Last Post: 06-22-2003, 10:56 PM
  4. Puzzled
    By sketchit in forum C Programming
    Replies: 3
    Last Post: 10-30-2001, 08:11 PM
  5. Still puzzled [I hope this formatted]
    By sketchit in forum C Programming
    Replies: 2
    Last Post: 09-28-2001, 01:26 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21