Announcements

Forum: C# Programming

  1. Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595

    Forum Rules FAQ

    Here are the 4 most common easy questions people face:

    Q: Can I delete my posts / Can I request that posts are deleted when my question is answered?

    A: We discourage post deletion, as the forum is a shared learning environment. A free-for-all on post deletion would mean whole threads consisting of meaningless isolated posts with no consistent narrative.

    For information on how to request that your posts or account be deleted, see the privacy policy.

    Q: Will my posts be found by other students / tutors?
    A: Almost certainly. Many forum regulars often search posted code to detect copy/paste programmers trying to pass off other peoples work as their own. If you "found" your code on the net, then so can everyone else.

    Q: What about other people copying my own work?
    A: If you publish first (and can prove it later by logging in in front of your tutor), you shouldn't have any problem so long as seeking forum help was within the terms of the assignment. Copiers have a much harder time explaining their actions.

    Q: How should I act on the forums?
    A: Be Nice.

    See below for more detailed forum guidelines and our homework policy and privacy policy.

  2. Administrator webmaster's Avatar
    Join Date
    Aug 2001
    Posts
    1,011

    Posting code? Read this first!

    (This was originally posted as a thread by biosx. Thanks biosx. I've made it an announcement so everyone can see it)

    This is more addressed to the newer people of this forum, but I think it would be a good refresher for some.

    USE CODE TAGS!!!

    What are code tags?
    They are HTML-Like tags that you can insert into your post and create a specially formatted box for source code.

    What are so special about these things?
    For one, they help show where you code begins and ends. Plus it doesn't mess with your spacing or indents (a typical aesthetic in programming).

    Why do you care so much?
    I love talking on these forums and giving and receiving help. However, when people are communicating code and there is no indentation and lousy spacing, code is super-hard to read.

    How do I use code tags?
    Well if you have any experience with HTML it is fairly simple to use. A tag has a beginning and ending. A beginning tag looks like this: [tag] and an ending tag looks like this: [/tag] . The tag name for the code tag is simple, it is "code". So to begin a code tag, type the following: [code] . Then type all your code or copy and paste, whatever you want. When you are done, use the closing tag which uses the same tag name but with a forward slash to denote a closed tag: [/code] .


    Example of nicely formatted code (with code tags):
    Code:
    int Stuff::save(Stuff *sPtr)
    {
       ofstream outfile("Outfile.txt");
    
       if( !outfile )
       {
          cerr << "Couldn't open file" << endl;
          return 1;
       }
    
       outfile << sPtr->string << endl << sPtr->stringTwo << endl << sPtr->num << endl;
    
       outfile.close();  // I don't trust destructors
    
       return 0;
    }
    
    int main()
    {
       Stuff stuffObject;
    
       strcpy(stuffObject.string, "Hello");
       strcpy(stuffObject.stringTwo, "Yo");
       stuffObject.num = 10;
    
       stuffObject.save(&stuffObject);
    
       return 0;
    }
    An example of dirty, ugly code (without code tags):
    int Stuff::save(Stuff *sPtr)
    {
    ofstream outfile("Outfile.txt");

    if( !outfile )
    {
    cerr << "Couldn't open file" << endl;
    return 1;
    }

    outfile << sPtr->string << endl
    << sPtr->stringTwo << endl
    << sPtr->num << endl;

    outfile.close(); // I don't trust destructors

    return 0;
    }

    int main()
    {
    Stuff stuffObject;

    strcpy(stuffObject.string, "Hello");
    strcpy(stuffObject.stringTwo, "Yo");
    stuffObject.num = 10;

    stuffObject.save(&stuffObject);

    return 0;
    }


    See the difference?

    Sorry, I had to get this off my chest

  3. Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595

    Homework

    Homework Policy:

    The purpose of these board is not for other people to do your homework for you. Try things out work on your own, homework has a purpose. If you still have trouble with a specific piece of code or concept please feel free to ask. But please do not ask people to do your entire homework for you, it simply annoys people most of the time.

    For an example check out thread written by Prelude. Thanks Prelude.

    Please note that this is a public forum. Posts that include parts of assignments are free for anyone to see. If your question is specific to a certain assignment, be aware that it will be visible to the public. It is possible your work may be copied by others.

    If you have any questions about what is appropriate, or anything else, please E-mail or PM me and I'll be happy to answer them.

    Thank you
    Kermi3
    Lead Moderator