Like Tree1Likes

void main { and file problem help!

This is a discussion on void main { and file problem help! within the C++ Programming forums, part of the General Programming Boards category; To be honest, the code is so bad...it's almost pointless to comment beyond telling the OP to actually learn the ...

  1. #16
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,650
    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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,614
    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
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,614
    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
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,706
    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 01:11 PM.

Page 2 of 2 FirstFirst 12
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, 02: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, 02:18 PM
  4. int main(void) whatever!
    By volk in forum C Programming
    Replies: 1
    Last Post: 01-11-2003, 06:42 PM
  5. void main(), int main(), argc, argv[]????
    By Jonny M in forum C Programming
    Replies: 3
    Last Post: 03-06-2002, 08:12 AM

Tags for this Thread


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