Thread: Need Help With C++ Console Homework Project

  1. #1
    Registered User
    Join Date
    Apr 2016
    Posts
    6

    Need Help With C++ Console Homework Project

    Howdy.
    My C++ teacher asked me to write this console project two weeks ago, I'm still trying but I couldn't write the program and I have just one week left. So I need your help with this, any help will be appreciated.

    http://s11.postimg.org/ia1b59cvn/Ads_z.png

    As you can see at the image above, my teacher asks for a digit extracting program. Sounds easy, right? Yeah, he asked for the same assignment before and I wrote that program. But this time he has strange conditions for the program so I need more experienced coders's help.

    My teacher said:
    -It needs to work up to 19 digits.
    -You need to use 10 semicolons maximum.
    -You need to use 3 variables maximum.
    -You need to use these ONLY: iostream.h, conio.h, if, getch.
    -You MUST NOT use these: for, while, do-while, goto, switch, until, repeat-until, try-catch etc.
    Or I'll get an F. Ain't that a ..........?


    I've made a digit extraction homework just like the image above only with "if" command. I have used 14 semicolons in total and it supported up to 5 digits. My teacher said he wants 10 semicolons max and 19 digit support or I'll get an F. I tried a lot but couldn't make an application with less semicolons.

    Some of you will say this is not the right way to teach C++, and If I want to learn it I need to write this myself. Yeah, you are right and this is not the best way to teach C++. I am aware of it and I want to learn java actually but this is my exam project and If I don't complete it, I will get an F and I won't get any java courses. So I need your help. I know this program is very stupid but I have to finish it.

    Notes:
    -My teacher said that he used if within an if and wrote it with 7 semicolons in total.
    -my classmate said that he found a command and wrote this program with just one variable and 7 semicolons but he doesn't tell me what it is, lol. Screw him.

    I hope you guys can help me with that. I'm looking forward to it. Thanks!

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Also posted here.

  3. #3
    Registered User
    Join Date
    Apr 2016
    Posts
    6
    Yeah and also posted to a few other forums. I need every help I can get.

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by Sikkirigi View Post
    Yeah and also posted to a few other forums. I need every help I can get.
    No, you need to be patient, and stop being an entitled, arrogant, self-important jerk.

    Also, you need to read the forum rules, which state that cross-posting is not allowed. You ask here, then you wait for an answer. If you don't receive an answer here, after a reasonable amount of time, then you post elsewhere, and make a note of it here, so that people who find your thread can go looking for the answer where you may have received one.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  5. #5
    Registered User
    Join Date
    Apr 2016
    Posts
    6
    I have to deliver it until this Sunday. I don't see any sign of arrogance. If you are going to help, I'll appreciate it. Thanks.

  6. #6
    Registered User
    Join Date
    Jun 2015
    Posts
    1,640
    Quote Originally Posted by Sikkirigi View Post
    I have to deliver it until this Sunday. I don't see any sign of arrogance. If you are going to help, I'll appreciate it. Thanks.
    Think about it.

    You've just asked, say, 20 people (since you've posted on "a few other forums") to help you with your problem with no knowledge that other people are helping you with it. Think of the duplication of effort. That's an incredible waste of people's time.

    Now that I know you've posted on multiple forums I simply can't help you. It would be a waste of time since you'll presumably get the answer elsewhere.

    If you knew the above and did it anyway, then you are simply a bad person. Why are you so special that you deserve to use people like that?

    In future, only post on one forum and wait at least an hour (preferably more) before posting on another. It would also be good to let people on the other forums know about the other posts so they can check to see if you've already gotten an answer before putting in their own time.

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by Sikkirigi View Post
    I have to deliver it until this Sunday. I don't see any sign of arrogance. If you are going to help, I'll appreciate it. Thanks.
    Arrogant: (adj.) having or revealing an exaggerated sense of one's own importance or abilities.

    By posting in multiple locations, you show your arrogance by believing that: 1. the rules do not apply to you, 2. Your time is too valuable to be wasted on reading the rules, or 3. Your problem is more important than everyone else's.

    Write your own code, and then ask for help with specific problems.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  8. #8
    Registered User
    Join Date
    Apr 2016
    Posts
    6
    Quote Originally Posted by algorism View Post
    Think about it.

    You've just asked, say, 20 people (since you've posted on "a few other forums") to help you with your problem with no knowledge that other people are helping you with it. Think of the duplication of effort. That's an incredible waste of people's time.

    Now that I know you've posted on multiple forums I simply can't help you. It would be a waste of time since you'll presumably get the answer elsewhere.

    If you knew the above and did it anyway, then you are simply a bad person. Why are you so special that you deserve to use people like that?

    In future, only post on one forum and wait at least an hour (preferably more) before posting on another. It would also be good to let people on the other forums know about the other posts so they can check to see if you've already gotten an answer before putting in their own time.
    I have already waited about a week when I posted it on the other forums. The people who helped me tried, but couldn't write the full working program yet so I decided to open another thread here. I thought about posting the solution when I get it to every forum I started the thread, but I still didn't get the program my teacher wanted. Like I told you, It's beyond my level. I didn't know about that cross-posting rule too.

  9. #9
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    The people who helped me tried, but couldn't write the full working program yet so I decided to open another thread here.
    This is really the problem, you're expecting us to write the solution for you. This is your assignment, you need to show some evidence that you're trying to take the advice given and work out a solution yourself, and IMO from what I've seen so far you're not willing to expend the effort to do the assignment.

    Edit. For example it was suggested that you use a recursive approach, yet no where do I see that you even attempted to use this idea. And if you didn't understand what was being suggested you never asked any follow up questions.

    Jim
    Last edited by jimblumberg; 04-06-2016 at 02:35 PM.

  10. #10
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Maybe we should do it, but obfuscate a message that says Sikkirigi didn't write this code. The effort to remove the message would be essentially a rewrite -- or so I would hope.

  11. #11
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Na, it seems like he's getting what he wants at one of his many other sites so why bother.

    Jim

  12. #12
    Registered User
    Join Date
    Apr 2016
    Posts
    6
    Don't worry, I'm not going to tell my teacher that I made this.
    Code:
    #include <iostream.h>
    #include <conio.h>
    
    int main()
    {
        unsigned long long sayi;
    
        cout << "Input number: ";
        if (!(cin >> sayi) || (sayi > 99999))
            return !!(cout << "Bad number" << endl);
    
        cout << sayi;
    
        size_t div, plus;
        if (plus = div = sayi / 10000)
            cout << " = " << div << "*10000";
    
        if (div = (sayi = sayi % 10000) / 1000)
            cout << (plus ? " + " : " = ") << div << "*1000";
    
        if (plus |= div, div = (sayi = sayi % 1000) / 100)
            cout << (plus ? " + " : " = ") << div << "*100";
    
        if (plus |= div, div = (sayi = sayi % 100) / 10)
            cout << (plus ? " + " : " = ") << div << "*10";
    
        if (plus |= div, div = sayi % 10)
            cout << (plus ? " + " : " = ") << div << "*1";
            getch();
    }
    I've made something like this, but as you can see it only works up to 5 digits. I know it can be done this way (and I know this isn't the right way) using : and ? operators but I don't know how to use them. Can you guys help me turn this program to 19-digit supporting program without exceeding the limits my teacher wanted? Thanks.

  13. #13
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    That's the same code you had about a week ago, what have you tried since then?

    Jim

  14. #14
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    > #include <iostream.h>
    > #include <conio.h>

    Get a teacher or class who keep up to date with the current C++ standard and do not
    use out-dated headers would also help. Teaching you a language is fine, but teaching
    you the stone age way of doing things is like trying it backwards before forwards.
    Double Helix STL

  15. #15
    Registered User
    Join Date
    Apr 2016
    Posts
    6
    I don't have a luxury like selecting my teachers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. get the key stroke in Win32 Console Project
    By maxcat in forum Windows Programming
    Replies: 6
    Last Post: 04-05-2008, 05:53 PM
  2. This Is Not Homework/ A Project
    By joebenjamin in forum C Programming
    Replies: 2
    Last Post: 09-24-2007, 08:42 PM
  3. Homework project(need help)
    By kantze in forum C++ Programming
    Replies: 8
    Last Post: 12-15-2006, 10:41 AM
  4. c++ console project how to set value in a class
    By kishu111 in forum C++ Programming
    Replies: 1
    Last Post: 12-03-2006, 08:02 PM
  5. Project Builder console app
    By Luigi in forum C++ Programming
    Replies: 0
    Last Post: 12-28-2002, 07:57 PM