Hello all, so recently I have started programming with C++ at college , it's not the main thing in my study program but it's for general education.So I have few program to do, anyway I'm still learning and maybe after few more lectures I will be able to them by myself but I really have much free time and trying to do them whenever I can so I wanna ask maybe someone can help me with these programs , I don't need a full code ( anyway it would be even better to have it ) but I just need some instructions or similar example how can I do them.
Here are the programs( btw sorry if something is unclear because I traslated them from my native language.
1:Writa a program which will double any natural number digits.So for example 123=112233 or 4567=44556677 and similar.
2:Write a program which prints 40 numbers who can be divided from all digits they have , for example 15 can be divided by 1 and by 5 and similar.
I have more programs but will try to do them by myself anyway if I won't figure out how to do them I will post here.
Start with a bare minimum program: Get a number from the user and print the number out. This will help you learn input, output and basic program syntax.
Next, I'd create a function to split a number into it's component digits: vector<int> digits(unsignedint n);
With this function, the first assignment is pretty easy. If you get stuck, post whatever code you have here and we'll help out.
For the second program, make a function that says whether a number is divisible by its digits: bool divisibleByDigits(unsignedint n);
This will call digits() to get the digits in n. Then you just need a loop to see if n is divisible by each of those digits.
With divisibleByDigits(), you can write code in main() to print the first 40 numbers that are divisible by their digits.
This is how you build up a program one step at a time. It means that when there is a problem you can be pretty sure that the problem is localized to a small section of new code.