|
| | #1 (permalink) |
| Bisous A.S. Join Date: Jan 2005
Posts: 548
| c++ retard homework math i'm taking an intro majors course called "C++", which has way too much theory thrown in and dumbing down of programming. Anyhow, our homework assignments consist of us writing header files that contain statements to manipulate given variables in various ways. Now, this is dumbed down because all variables are given (not declared or defined by me, i see nothing and i can only use them), statements do NOT end with a semicolon. the teacher is using some buttfucking code to pull whatever code you type into his file to use it, so for me it just looks like algebra for the most part. Now, the problem: "write an expression which will calculate the value of the (integer) tens digit (second digit from the right) of a non-negative integer called "val". This is more general math than language specific but i have NO clue how to do this so that it works in ALL cases without actually "programming" so to speak (if, else, then...). is this possible? does anyone know how to do it? for any two-digit number "val / 10" works because it drops the remainder. for any single digit "val / 10" works because it simply returns 0 which is what he wants it to do. anything 3 digits or more obviously does NOT work and simply drops the digit in the original ONES part of the number. "2345 / 10 = 234", etc etc... i THINK i have to do this using basic arithmatic and i don't think i can make any conditional cases. also, if this is really simple for someone give me a break. i'm a senior biology major. i have experience programming, but i made games and didn't deal with much algebraic problem solving. |
| | |
| | #6 (permalink) | |
| Math Enthusiast/Badass MC Join Date: Jun 2002 Location: Seattle
Posts: 611
| Quote:
| |
| | |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
| |