Thread: i need help of my seatselling function.i dont know where am i do wrong!

  1. #16
    Registered User
    Join Date
    Sep 2019
    Posts
    8
    how can i write the 2d array SeatF[7][10] into the text file?
    Code:
    int text(int SeatF[7][10]){
    	int i,j;
        FILE *fp;
        fp=fopen("a.txt","w");
        for(i=0; i<7; i++){
          for(j=0;j<10;j++){
             printf("%f",SeatF[i][j]);
                printf("\n");
         }
        }
    }
    the file have no changes in these codes.

  2. #17
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    If you do not close or flush the output file, the file is often not saved.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > printf("%f",SeatF[i][j]);
    %f prints floats, not ints.

    > printf("\n");
    Now, are you trying to print all the seats for one all on the same line?
    Or just every seat on a line by itself?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. dont know where im going wrong
    By africanwizz in forum C Programming
    Replies: 5
    Last Post: 10-06-2013, 08:32 AM
  2. I dont know what is wrong???
    By amroto in forum C Programming
    Replies: 3
    Last Post: 05-18-2012, 06:19 AM
  3. dont know whats wrong
    By otchster in forum C Programming
    Replies: 2
    Last Post: 11-02-2005, 11:14 AM
  4. i dont know what is wrong with it (help plz)
    By abuna in forum C++ Programming
    Replies: 16
    Last Post: 09-08-2005, 12:03 PM
  5. help......i dont understand what i am doing wrong?
    By Grifftt in forum C Programming
    Replies: 2
    Last Post: 10-18-2002, 11:37 PM

Tags for this Thread