Thread: void main { and file problem help!

  1. #16
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    To be honest, the code is so bad...it's almost pointless to comment beyond telling the OP to actually learn the language.

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by brewbuck View Post
    This thread is depressing. A lot of misdirected criticism, no actual help. Yes, the code is calling some C IO functions. Big whoop.
    I am inclined to disagree.
    Knowing what language the OP is actually trying to learn would help in knowing what to teach.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    The OP states clearly multiple times that the program is C++. Nothing in the source code contradicts that, so why are you pretending it's some kind of open question?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Everything in the code contradicts it, because it's all C. All of it.
    It seems to be strictly C90.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    One of the bigger problems is that I don't see any member for the gender of the kindergartner, even though it is used several times in the program.

    I mean, a gender string is declared somewhere, but it's not going to change the problem with expressions like this.
    Code:
    fscanf(thefile,"%s%s%s%s%d%d%s",kids[i].id,kids[i].name,kids[i].age,&kids[i].weight,&kids[i].height,kids[i].gender);
    So you should group all of the data in a single type.

    Code:
    for(i=0;i>0;i++); {
    What is with this loop that doesn't even execute?

    Also, listen to the people telling you to format/indent. It's important, especially when you want to show people code.

    And, for good measure everyone, I agree with brewbuck. Realistically, the sort of advice I was able to give applies to C and C++ equally. I mean, we can address the issue of not using classes, or iostream objects later. C++ does nothing to stop you from using it this way anyway.
    Last edited by whiteflags; 12-27-2011 at 02:11 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [DEBATE]int main VS void main?
    By sudox in forum C++ Programming
    Replies: 20
    Last Post: 11-26-2010, 03:18 PM
  2. Why do people still use main() or main(void)?
    By Christopher2222 in forum C Programming
    Replies: 18
    Last Post: 06-06-2007, 06:34 PM
  3. A question about void(main) and int(main)
    By edd1986 in forum C Programming
    Replies: 2
    Last Post: 03-05-2005, 03:18 PM
  4. int main(void) whatever!
    By volk in forum C Programming
    Replies: 1
    Last Post: 01-11-2003, 07:42 PM
  5. void main(), int main(), argc, argv[]????
    By Jonny M in forum C Programming
    Replies: 3
    Last Post: 03-06-2002, 09:12 AM

Tags for this Thread