Thread: help with seating chart thingy

  1. #1
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942

    help with seating chart thingy

    Problem: assignment from 'char' to 'char *' lacks a cast---49
    parse error at end of input---55

    The Code:

    Code:
    #include <iostream.h>
    #include <stdlib.h>
    #include <fstream.h>
    
    #define MAX 6
    #define MAXLENGTH 8
    #define MAXDAYS 7
    #define DAYLENGTH 10
    
    void arrange();
    
    int main()
    {
          arrange();
          system("PAUSE");
          return 0;
    }
    void arrange(void)
    {
         int time=1;
         int turn=1;
         char seat[MAX][MAXLENGTH]={0};
         char day[MAXDAYS][DAYLENGTH]={
                                        "Monday" ,
                                        "Tuesday" ,
                                        "Wednesday" ,
                                        "Thursday" ,
                                        "Friday" ,
                                        "Saturday" ,
                                        "Sunday" ,
                                        };
         char storedays[MAX][MAXDAYS]={0};
         ofstream a_file("C:/Windows/Desktop/Seating.wpd");
              {
              for(turn=1 ;turn <= MAX ;turn++)
              {
                        cout << "Who is in seat "<< turn << " on Monday?"
                             << endl;
                        cin >> seat[turn-1];
                        cout << "Seat " << turn << " on Monday" << ": "
                             << seat[turn-1]
                             << endl;
                        a_file << "Seat " << turn << ": " << seat[turn-1] << " on Monday" << endl;
              }
              turn=2;
              upfor:
              for(time=1 ;time <= MAXDAYS ;time++)
              {
                         storedays[time-1][turn-1]=seat[turn-1];
                         a_file << "Seat " << turn << ": " << seat[turn-1] << " on " << time-1 << endl;
              }
              turn++;
              goto upfor;
    }

  2. #2
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942
    and don't be mean to me for the

    goto upfor;
    Last edited by gcn_zelda; 04-30-2003 at 08:25 PM.

  3. #3
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Your problem is this line:
    Code:
    storedays[time-1][turn-1]=seat[turn-1];
    storedays[][] is a single char while seat[] is a char array. Did you mean this:
    Code:
    storedays[time-1][turn-1]=seat[turn-1][turn-1]; //  ???
    Last edited by PJYelton; 05-01-2003 at 09:10 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Chart!
    By 98dodgeneondohc in forum C Programming
    Replies: 13
    Last Post: 04-22-2005, 10:03 AM
  2. Need help regarding ActiveX Chart Object
    By Hankyaku in forum C++ Programming
    Replies: 2
    Last Post: 02-19-2005, 04:38 PM
  3. Drawing a simple chart?
    By C++NewUser in forum C++ Programming
    Replies: 1
    Last Post: 09-05-2002, 07:45 AM
  4. How to draw a chart like spreadsheet in C
    By dv007 in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 06-06-2002, 01:28 PM
  5. outputting a ASCII chart
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 02-15-2002, 11:55 AM