Thread: Homework due tonight! help please!!

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    23

    Unhappy Homework due tonight! help please!!

    I'm learning C++ code in my engineering class, but my professor doesn't help, or explain. He just gives homework. Here is my assignment (it is split into 4 parts):

    1.) Write a program that reads a data file and determines the number of occurrences of each of the characters in the file; then, print the characters and the number of times that they occurred; if a character does not occur, do not print it (hint: use an array to store the occurrences of the characters based on their ASCII codes)


    The problem with the first one is that I don't know how to get the program to only print the characters that occur in the data file, mine prints all of the letters in the alphabet.


    So, ill post this now while i work on posting the other 3 parts.

  2. #2
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Welcome to the boards. If you haven't already done so then please take some time to familiarise yourself with the faq:
    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

    Make sure you have a look at the the posting guidelines:
    http://cboard.cprogramming.com/annou...ouncementid=51
    Following the rules will ensure you get a prompt answer to your question.

    Remember, too, that the board has a search facility, a link is at the top of your screen:
    http://cboard.cprogramming.com/search.php
    It will often get you a quicker answer to your questions than waiting for a response to one you have posted.


    If you have any questions about this you may ask or you can contact one of our forum leaders:

    http://cboard.cprogramming.com/showgroups.php

    ----------

    Quote Originally Posted by Andy717
    So, I'll work on this now, and post what I have after I've had a try at it. Or, if I'm really stuck, I'll ask a more specific question focused on exactly what it is that I don't know. I apologize for expecing you to do my homework for me. I realize that I won't learn anything from that and appreciate that you care for my long-term well-being.
    fixt.
    Last edited by major_small; 04-07-2005 at 11:25 AM.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    23
    Here is the second one:

    "another simple code encodes a message in text such that the true message is represented by the first letter of each word; there are no spaces between the words, but the decoded string of characters can easily be separated into words by a person; write a program to read a data file and determine the secret message stored by the sequence of first letters of the words (hint: use the string class, and store the first letter of each word in a character string)"


    that one i have done, except it prints the results vertically instead of horizontally, so if anyone can help me with how to fix that, i'd appreciate it.

  4. #4
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    read my first post before I slap you with a large trout >.<
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  5. #5
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Quote Originally Posted by Andy717
    that one i have done, except it prints the results vertically instead of horizontally, so if anyone can help me with how to fix that, i'd appreciate it.
    Stop printing newlines when you don't want them.

    Funny how you so desperately need help because your homework is due tonight. I really doubt it was assigned today. You should go talk to your profs when you're having trouble (or TAs who are sometimes nicer), and you should start programming assignments before the day it's due to allot time for unforseen difficulties and bugs.

  6. #6
    Registered User
    Join Date
    Apr 2005
    Posts
    23
    So, I'll work on this now, and post what I have after I've had a try at it. Or, if I'm really stuck, I'll ask a more specific question focused on exactly what it is that I don't know. I apologize for expecing you to do my homework for me. I realize that I won't learn anything from that and appreciate that you care for my long-term well-being.

  7. #7
    Registered User
    Join Date
    Apr 2005
    Posts
    23
    no, i've asked my prof for many meetings, and he wont meet with me oh well.. i figured out a way for it to be horizontal
    And i've been working on this since friday night, but.. i just didn't get it, so i thought id ask for a bit of help... sorry if im bothering anyone
    Last edited by Andy717; 04-07-2005 at 11:33 AM.

  8. #8
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Are you serious, your prof won't meet with you? That's frakked up, man. I'd go talk to his department head about that. Professors are supposed to be available to help out students. Doesn't he have office hours?

  9. #9
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by joshdick
    Are you serious, your prof won't meet with you? That's frakked up, man. I'd go talk to his department head about that. Professors are supposed to be available to help out students. Doesn't he have office hours?
    not necessarily... some professors are really stuck up about their level of education. they expect you to respect and live up to their level, or you're not 'good enough'...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  10. #10
    Registered User
    Join Date
    Apr 2005
    Posts
    23
    no, he met with me once before, for a previous assignment.. but that was a while ago. And when i ask him, he wont.. i e-mail him with questions, and he doesn't reply. It's his first year teaching though.. so.. he doesn't like helping very much

  11. #11
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    well what questions are you asking him? we appreciate more targetted questions than "I don't know how to do this" type of questions... you need to at least tell us where you're stuck so we can help unstick you and send you along your merry way...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  12. #12
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Quote Originally Posted by major_small
    not necessarily... some professors are really stuck up about their level of education. they expect you to respect and live up to their level, or you're not 'good enough'...
    That's their problem and not mine, and if I knew of a professor at my school who wouldn't meet with me to answer questions, I'd get a bunch of my classmates together and we'd all meet with the department head. If the problem didn't get resolved soon after that, I'd start calling for his termination in the department, in the school newspaper and anywhere else on campus where people would listen to me.

    No joke. Professors are teachers, and they ought to act that way. Any prof that can't handle that ought to find another profession.

  13. #13
    Registered User
    Join Date
    Apr 2005
    Posts
    23
    ok, well, i'm kinda stuck on the whole code, heh.. but.. I can't get the character array named "key" to read from the keyboard

  14. #14
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Post your code.

  15. #15
    Registered User Scribbler's Avatar
    Join Date
    Sep 2004
    Location
    Aurora CO
    Posts
    266
    The hint to use an array in the first project should give it away for you.

    Create an array of 128 elements (0 - 127). Initialize all the elements to zero. Now think about what you can do with each element while you're reading in characters, and how you can tell which chars were used and which weren't.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 50 percent for this homework?
    By a.mlw.walker in forum C Programming
    Replies: 2
    Last Post: 03-22-2009, 05:15 PM
  2. please help..linked list homework assignment due tomorrow..
    By rocketman03 in forum C Programming
    Replies: 2
    Last Post: 11-23-2008, 06:32 PM
  3. Help Someone! First program/errors and its due tonight!
    By LittleLotte in forum C Programming
    Replies: 4
    Last Post: 02-02-2005, 09:21 AM
  4. Its Late...Due Tonight....Help Please
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 11-13-2001, 03:18 PM
  5. Homework
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 11-03-2001, 04:39 PM