Public Group

# Help with a school project?

This topic is 5039 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey everybody. I'm fairly new to programming, but I would like to learn more about it. I've been reading some tutorials and books, and I've been progressing through some "childish" stuff. I do have a question, though. I have an extra credit project in one of my classes, and it could raise my grade significantly. To an A, to be exact...even if I fail the final. I need to make a DOS executable. It needs to be able to take five number fives and use any symbol to obtain a certain number. So say I have 5-5+5+5+5. That obviously equals 15. Or say I have 5x5x5x5x5 (3125). Or say I even have 5x5x5x5 divided by 5 (125). But, it gets more advanced. I'd have to be able to get a number by putting in 5 to the 5555 power (27,775). I need to be able to type in the target number and get the equation in return. How would I go about doing this? If I could get any input from anyone, I would greatly appreciate it...and so would my low grade in the class. Thanks. edit: I'm using Microsoft Visual C++ 6.0.

##### Share on other sites
People will probably be reluctant to help too much since this is for school, but I'm guessing you may find this quite tricky regardless.

I can't immediately think of an obvious way to reverse-engineer an equation like that from a number. There's another way to do it, though - precalculate the values of the equation for every permutation of operators, store the expression & value pairs somehow, and search through them when you need to find an appropriate expression for a given value. That's one possible strategy, and there's quite a few details for you to work out if you choose to follow it, like how you generate/evaluate the expressions and how you store/use the precalculated data.

There's quite a few permutations - it's the factorial of the number of operators. It looks like you are also allowing the omission of an operator, too, so you can have expressions like 5*55-555? And since I don't see any brackets in your expressions, I'm assuming you aren't using them? Brackets make things more complicated. So, you have +, -, /, *, ^ and an empty operator, which is 6. So, if you're not including brackets, you need to calculate 6! expressions, or 720. That kind of number is quite feasible to calculate when the app starts without anyone really noticing. If you do need to use brackets, you'll need to extend this rough design to accommodate them.

Good luck with it anyway :o) I expect you'll get some credit for it even if you don't get it all working perfectly, so long as you demonstrate some problem-solving skills.

##### Share on other sites
the best way i can see and the previous person probibly covered this (by the way if you want to preserve the text structure for that tree then use // without the slashes). Ok what i would do i read in an equation then store it in a text file and a string, this alows you to do more with it. then parse through the file several times one time for each operator speed level ^ = 3* and / = 2+ and - = 1then do the operation to the numbers on either side of the equation so 6 ^ 2read it in then on the fist pass you find a ^ rewinde to the last number befor the ^ store it in a variable then go 2 chars ahead of that (the number after) and store it then do the ^ operation (whatever then function is in the math library (i dont know i dont use it much yet))and store it then print a | symbol before the number on the left side of the operator (this is in case of duplicates) now go throught the string find a the spot were the | is and delete 3 numbers/operators after that then print your new value at the spot right after the | then erase the | (and the space that it leaves if any) and this should give you a nice step by step brake down of how you solved the equation. this dose of course get slighty more complicated if you have bracets other then that though. If any questions about this method let me know. I havnt done this before i just made this up on the fly so use at own risk (i think ill try this some time) 
 0 
 Share this post Link to post Share on other sites 
 
 
 iMalc    2466 iMalc Member 2466 Posted January 6, 2005 If you currently have a low grade, then to deserve an 'A' I'd say you should get stuck into it on your own, and do lots of thinking and research of your own.People here have given you enough to start on already.This website has a policy to not do people's homework for them. 0 Share this post Link to post Share on other sites 
 Sign in to follow this   Followers 0 
 Go To Topic Listing Forum 
 Advertisement 
 Advertisement Popular Tags 2D 3D Advice Algorithm C# C++ Concept Design DX11 Education GameMaker Gameplay General HTML5 Java Javascript Learning Mobile Music OpenGL PC SFX Unity Unreal Visual Studio Popular Contributors Week Month Year All Time 1 Rutin 46 2 Hodgman 31 3 lawnjelly 31 4 jbadams 26 5 JoeJ 19 Show More Advertisement Popular Now 13 Being Hired as Co-Writer for an Indie Studio - Question about Fixed + Revenue Share By Raze23Started Yesterday at 06:58 AM 10 Requesting a code review By KuurdeStarted Sunday at 07:49 AM 12 Help: Solo programmer: What to do about Assets? By PlotnusStarted Saturday at 07:00 AM 10 Allow to slide rectangle avoiding corner collision By AsierStarted Friday at 10:26 PM 13 3D artist looking for experience and motivation By supermikhailStarted Friday at 12:28 PM Forum Statistics Total Topics 632998 Total Posts 3009808 Who's Online (See full list) There are no registered users currently online GameDev.net GameDev.net Articles GameDev.net Event Coverage GameDev.net Forums GameDev.net Blogs GameDev.net Gallery GameDev.net News GameDev.net Projects GDNet Chat All Activity Search In Everywhere This Forum This Topic More options... Find results that contain... All of my search term words Any of my search term words Find results in... Content titles and body Content titles only Home Groups For Beginners Forum Help with a school project? 
 
 
 × Existing user? Sign In Sign Up Browse Back Articles & Tutorials Back All Categories Audio Business Game Design Industry Programming Visual Arts Columns Back GameDev Unboxed Event Coverage Back All Events Game Developers Conference Power Up Digital Games Conference GameDev.Market Links News Podcasts Back All Podcasts Game Dev Loadout Archive Community Back Beginners Back Beginners Group Beginners Forum Beginners Resources Blogs Calendar Chat Forums Back All Forums Audio Business Game Design Programming Visual Arts Community GameDev Challenges Affiliates Topical Workshops Gallery Groups Back For Beginners GameDev Challenges All Groups Projects Back All Projects Games Game Assets Game Mods Developer Tools Store Forums Back All Forums For Beginners Audio Back Music and Sound FX Games Career Development Business Back Games Career Development Production and Management Games Business and Law Game Design Back Game Design and Theory Writing for Games Programming Back Artificial Intelligence Engines and Middleware General and Gameplay Programming Graphics and GPU Programming Math and Physics Networking and Multiplayer Visual Arts Back 2D and 3D Art Critique and Feedback Community Back GameDev Challenges GDNet Lounge GDNet Comments, Suggestions, and Ideas Coding Horrors Your Announcements Hobby Project Classifieds Indie Showcase Affiliates Back NeHe Productions AngelCode Topical Workshops Careers Back Contractors Hobby Projects Game Jobs Back Browse on GameDev.Jobs Post a Job Members Back Subscriptions Chat Guidelines Leaderboard Online Users Awards Search Back All Activity My Activity Streams Back Latest Topics Featured Blogs Search var ipsDebug = false; var CKEDITOR_BASEPATH = '//www.gamedev.net/applications/core/interface/ckeditor/ckeditor/'; var ipsSettings = { cookie_path: "/", cookie_prefix: "ips4_", cookie_ssl: true, upload_imgURL: "", message_imgURL: "", notification_imgURL: "", baseURL: "//www.gamedev.net/", jsURL: "//www.gamedev.net/applications/core/interface/js/js.php", csrfKey: "b625f3785a27bd00d926f5da681922f4", antiCache: "14de000c45", disableNotificationSounds: false, useCompiledFiles: true, links_external: true, memberID: 0, analyticsProvider: "ga", viewProfiles: true, mapProvider: 'google', mapApiKey: "AIzaSyAeT7tk3vnWWmbgVISkLpbhkQvekG19rHM", }; ips.setSetting( 'date_format', jQuery.parseJSON('"mm\/dd\/yy"') ); ips.setSetting( 'date_first_day', jQuery.parseJSON('0') ); ips.setSetting( 'remote_image_proxy', jQuery.parseJSON('1') ); ips.setSetting( 'ipb_url_filter_option', jQuery.parseJSON('"none"') ); ips.setSetting( 'url_filter_any_action', jQuery.parseJSON('"allow"') ); ips.setSetting( 'bypass_profanity', jQuery.parseJSON('0') ); ips.setSetting( 'emoji_style', jQuery.parseJSON('"native"') ); ips.setSetting( 'emoji_shortcodes', jQuery.parseJSON('"1"') ); ips.setSetting( 'emoji_ascii', jQuery.parseJSON('"1"') ); ips.setSetting( 'emoji_cache', jQuery.parseJSON('"1"') ); ips.setSetting( 'quickSearchDefault', jQuery.parseJSON('"all"') ); ips.setSetting( 'quickSearchMinimum', jQuery.parseJSON('3') ); ips.setSetting( 'quickSearchShowAdv', jQuery.parseJSON('true') ); ips.setSetting( 'quickSearchIn', jQuery.parseJSON('"title"') ); { "@context": "http://schema.org", "@type": "DiscussionForumPosting", "url": "https://www.gamedev.net/forums/topic/292584-help-with-a-school-project/", "discussionUrl": "https://www.gamedev.net/forums/topic/292584-help-with-a-school-project/", "name": "Help with a school project?", "headline": "Help with a school project?", "text": "Hey everybody. I\u0027m fairly new to programming, but I would like to learn more about it. I\u0027ve been reading some tutorials and books, and I\u0027ve been progressing through some \"childish\" stuff. I do have a question, though. I have an extra credit project in one of my classes, and it could raise my grade significantly. To an A, to be exact...even if I fail the final. I need to make a DOS executable. It needs to be able to take five number fives and use any symbol to obtain a certain number. So say I have 5-5+5+5+5. That obviously equals 15. Or say I have 5x5x5x5x5 (3125). Or say I even have 5x5x5x5 divided by 5 (125). But, it gets more advanced. I\u0027d have to be able to get a number by putting in 5 to the 5555 power (27,775). I need to be able to type in the target number and get the equation in return. How would I go about doing this? If I could get any input from anyone, I would greatly appreciate it...and so would my low grade in the class. Thanks.\n\nedit: I\u0027m using Microsoft Visual C++ 6.0.", "dateCreated": "2005-01-05T18:05:09+0000", "datePublished": "2005-01-05T18:05:09+0000", "pageStart": 1, "pageEnd": 1, "image": "https://secure.gravatar.com/avatar/ae10e92bd9b9655e3cb13b8f598a3fc0?d=https://www.gamedev.net/uploads/monthly_2017_08/M.png.a4120f7e47e5016f1c1d5fe2eedbeac6.png", "author": { "@type": "Person", "name": "m4gilla", "image": "https://secure.gravatar.com/avatar/ae10e92bd9b9655e3cb13b8f598a3fc0?d=https://www.gamedev.net/uploads/monthly_2017_08/M.png.a4120f7e47e5016f1c1d5fe2eedbeac6.png", "url": "https://www.gamedev.net/profile/72889-m4gilla/" }, "interactionStatistic": [ { "@type": "InteractionCounter", "interactionType": "http://schema.org/ViewAction", "userInteractionCount": 440 }, { "@type": "InteractionCounter", "interactionType": "http://schema.org/CommentAction", "userInteractionCount": 3 }, { "@type": "InteractionCounter", "interactionType": "http://schema.org/FollowAction", "userInteractionCount": 47 } ], "comment": [ { "@type": "Comment", "url": "https://www.gamedev.net/forums/topic/292584-help-with-a-school-project/?do=findComment\u0026comment=292584", "author": { "@type": "Person", "name": "m4gilla", "image": "https://secure.gravatar.com/avatar/ae10e92bd9b9655e3cb13b8f598a3fc0?d=https://www.gamedev.net/uploads/monthly_2017_08/M.png.a4120f7e47e5016f1c1d5fe2eedbeac6.png", "url": "https://www.gamedev.net/profile/72889-m4gilla/" }, "dateCreated": "2005-01-05T18:05:09+0000", "text": "Hey everybody. I\u0027m fairly new to programming, but I would like to learn more about it. I\u0027ve been reading some tutorials and books, and I\u0027ve been progressing through some \"childish\" stuff. I do have a question, though. I have an extra credit project in one of my classes, and it could raise my grade significantly. To an A, to be exact...even if I fail the final. I need to make a DOS executable. It needs to be able to take five number fives and use any symbol to obtain a certain number. So say I have 5-5+5+5+5. That obviously equals 15. Or say I have 5x5x5x5x5 (3125). Or say I even have 5x5x5x5 divided by 5 (125). But, it gets more advanced. I\u0027d have to be able to get a number by putting in 5 to the 5555 power (27,775). I need to be able to type in the target number and get the equation in return. How would I go about doing this? If I could get any input from anyone, I would greatly appreciate it...and so would my low grade in the class. Thanks.\n\nedit: I\u0027m using Microsoft Visual C++ 6.0.", "mainEntityOfPage": "https://www.gamedev.net/forums/topic/292584-help-with-a-school-project/" }, { "@type": "Comment", "url": "https://www.gamedev.net/forums/topic/292584-help-with-a-school-project/?do=findComment\u0026comment=2848682", "author": { "@type": "Person", "name": "HarryW", "image": "https://secure.gravatar.com/avatar/d7b7d364c96d48dbe752af6540ff9e7a?d=https://www.gamedev.net/uploads/monthly_2017_08/H.png.98cb96b73ec7a0d02b9dbd4003608b3e.png", "url": "https://www.gamedev.net/profile/12612-harryw/" }, "dateCreated": "2005-01-05T19:30:30+0000", "text": "People will probably be reluctant to help too much since this is for school, but I\u0027m guessing you may find this quite tricky regardless.I can\u0027t immediately think of an obvious way to reverse-engineer an equation like that from a number. There\u0027s another way to do it, though - precalculate the values of the equation for every permutation of operators, store the expression \u0026amp; value pairs somehow, and search through them when you need to find an appropriate expression for a given value. That\u0027s one possible strategy, and there\u0027s quite a few details for you to work out if you choose to follow it, like how you generate/evaluate the expressions and how you store/use the precalculated data.There\u0027s quite a few permutations - it\u0027s the factorial of the number of operators. It looks like you are also allowing the omission of an operator, too, so you can have expressions like 5*55-555? And since I don\u0027t see any brackets in your expressions, I\u0027m assuming you aren\u0027t using them? Brackets make things more complicated. So, you have +, -, /, *, ^ and an empty operator, which is 6. So, if you\u0027re not including brackets, you need to calculate 6! expressions, or 720. That kind of number is quite feasible to calculate when the app starts without anyone really noticing. If you do need to use brackets, you\u0027ll need to extend this rough design to accommodate them.Good luck with it anyway :o) I expect you\u0027ll get some credit for it even if you don\u0027t get it all working perfectly, so long as you demonstrate some problem-solving skills.", "mainEntityOfPage": "https://www.gamedev.net/forums/topic/292584-help-with-a-school-project/" }, { "@type": "Comment", "url": "https://www.gamedev.net/forums/topic/292584-help-with-a-school-project/?do=findComment\u0026comment=2848880", "author": { "@type": "Person", "name": "raptorstrike", "image": "https://secure.gravatar.com/avatar/9e6a895b8670d06c770d2cf5144c1c4c?d=https://www.gamedev.net/uploads/monthly_2017_08/R.png.0ee0725727730a481e55ac73fe18f649.png", "url": "https://www.gamedev.net/profile/62713-raptorstrike/" }, "dateCreated": "2005-01-05T22:05:04+0000", "text": "the best way i can see and the previous person probibly covered this (by the way if you want to preserve the text structure for that tree then use // without the slashes). Ok what i would do i read in an equation then store it in a text file and a string, this alows you to do more with it. then parse through the file several times one time for each operator speed level ^ = 3* and / = 2+ and - = 1then do the operation to the numbers on either side of the equation so 6 ^ 2read it in then on the fist pass you find a ^ rewinde to the last number befor the ^ store it in a variable then go 2 chars ahead of that (the number after) and store it then do the ^ operation (whatever then function is in the math library (i dont know i dont use it much yet))and store it then print a | symbol before the number on the left side of the operator (this is in case of duplicates) now go throught the string find a the spot were the | is and delete 3 numbers/operators after that then print your new value at the spot right after the | then erase the | (and the space that it leaves if any) and this should give you a nice step by step brake down of how you solved the equation. this dose of course get slighty more complicated if you have bracets other then that though. If any questions about this method let me know. I havnt done this before i just made this up on the fly so use at own risk (i think ill try this some time)", "mainEntityOfPage": "https://www.gamedev.net/forums/topic/292584-help-with-a-school-project/" }, { "@type": "Comment", "url": "https://www.gamedev.net/forums/topic/292584-help-with-a-school-project/?do=findComment\u0026comment=2849057", "author": { "@type": "Person", "name": "iMalc", "image": "https://secure.gravatar.com/avatar/7c59e78fa8fc9045eec10b9f66d31c69?d=https://www.gamedev.net/uploads/monthly_2017_08/I.png.6e46b2554d24e62b35f532917490c538.png", "url": "https://www.gamedev.net/profile/56591-imalc/" }, "dateCreated": "2005-01-06T01:17:14+0000", "text": "If you currently have a low grade, then to deserve an \u0027A\u0027 I\u0027d say you should get stuck into it on your own, and do lots of thinking and research of your own.People here have given you enough to start on already.This website has a policy to not do people\u0027s homework for them.", "mainEntityOfPage": "https://www.gamedev.net/forums/topic/292584-help-with-a-school-project/" } ] } { "@context": "http://www.schema.org", "@type": "WebSite", "name": "GameDev.net", "url": "https://www.gamedev.net/", "potentialAction": { "type": "SearchAction", "query-input": "required name=query", "target": "https://www.gamedev.net/search/?q={query}" }, "inLanguage": [ { "@type": "Language", "name": "English (USA)", "alternateName": "en-US" } ] } { "@context": "http://www.schema.org", "@type": "Organization", "name": "GameDev.net", "url": "https://www.gamedev.net/", "address": { "@type": "PostalAddress", "streetAddress": "", "addressLocality": null, "addressRegion": null, "postalCode": null, "addressCountry": null } } { "@context": "http://schema.org", "@type": "BreadcrumbList", "itemListElement": [ { "@type": "ListItem", "position": 1, "item": { "@id": "https://www.gamedev.net/groups/", "name": "Groups" } }, { "@type": "ListItem", "position": 2, "item": { "@id": "https://www.gamedev.net/groups/2-for-beginners/", "name": "For Beginners" } }, { "@type": "ListItem", "position": 3, "item": { "@id": "https://www.gamedev.net/forums/forum/71-for-beginners/", "name": "Forum" } } ] } { "@context": "http://schema.org", "@type": "ContactPage", "url": "https://www.gamedev.net/contact/" } Important Information By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.   I accept We are the game development community. Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up! Sign me up!