Re: [Dev-C++] Print numbers up to n digits wide of number system base m.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Brian P. <BP...@go...> - 2001-11-16 05:25:51
|
ok ... hint #2 you need /, %, pow, 2 for loops, and a if however my answer gives you one extra number, but I guess I could put it in a vector and pop the top. if you want the code to look at ... e-mail me or the list and put more of these kind of questions up, I love them. -----Original Message----- From: "Dario Peralta"<do...@ho...> To: dev...@li... Date: Thu Nov 15 04:10:37 PST 2001 Subject: [Dev-C++] Print numbers up to n digits wide of number system base m. > >/* >Let m be an integer, greater than zero but less than eleven. Numerical >strings, in which each digit is greater or equal to 0 but less than m, are >numbers of the number system in the base m. The numbers 10110 and 1981, for >example, are numbers of the number system in the base the 10, but only the >first one is a number of the number system in the base 2. The zeros at the >beginning of the number are leading zeros, unless the number is 0. > >Write a program that reads the integers m and n, and outputs all numbers of >the number system in the base m containing n digits at the most, and without >leading zeros. Each number may be output only once. > >You may assume that m is greater than 0, but less than 11, and that n is >greater than 0 but less than 81. > >The numbers should be output on consecutive lines, one number per line >*/ > >I've been banging my head over this problem since last week, and i'm no >closer to an answer than i was when i started. > >I find myself always coming back to the idea of implementing a bidimensional >array as such: nsys[n][m] > >But i can't figure out the system of loops and conditions that would >correctly solve this problem. > >I'm hopelessly stuck. I'll keep banging my head, but i doubt i'll answer >this. > >I thought i'd ask for some help. Some clever hints would be better than the >straight answer, as i would like to figure out as much of it by myself as i >can. But i really need help. > >Thanks... > >adios, >biterman. > ><<That government is best which governs the least... that government is best >which governs not at all.>> > > >_________________________________________________________________ >Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ___________________________________________________ GO.com Mail Get Your Free, Private E-mail at http://mail.go.com |