Hello!
I just finished learning about very basics in C++ using lynda.com and next chapter is arrays. I got this task there, which I don't understand.
Maybe there is someone who would like to write something of this task and comment code or just explain to me.
Problem is, I don't understand logic of this program.I know how to repeat program with out leaving it, but that wont help me to create main function :D
I am thinking to start UNI in computer science next year, but until then I want to learn something by myself, so its easier for me to succeed there.
Write C++ program in which user has to enter whole number array. Create new array in which are recorded every number digit No.
It should be possible to execute the program again without leaving the program.
Also I would appreciate some tips and maybe websites where I can practice C++(where are tasks and I am writing program step by step,I saw something similar for Java)
In simple terms you can think of "size_t" as another name for an "unsigned in". Actually it is a "typedef".
When defining a constant variable name capital letters are used to remind you that it is a constant variable.
The {}s are used in two ways: first to initialize "MAXSIZE" to 100. Second to initialize the entire array to zero.
The purpose of "MAXSIZE" is that you can use it anywhere in "main" and only have one place to change its size if needed. Then everywhere it is used will change when the program is compiled.
I would guess that you would use a for loop or while loop to make the entries. Defining a variable like "count" or "amtUsed" will let you know how much of the array is actually used. This way when dealing with the array you will only process the part that is used and not the whole array.
Hope that helps,
Andy
P.S. The link https://en.cppreference.com/w/ is a good place to find information about key words and functions in C++. A good link to bookmark for future use.
Write C++ program in which user has to enter whole number array.
Create new array in which are recorded every number digit No.
It should be possible to execute the program again without leaving the program.
The first line sounds simple: "read numbers from user (std::cin)".
What does "record number digit No" mean?
The third line is a separate task that does not relate to the arrays in any way.
Lets say you have got a program done that does lines 1-2 once and it looks like: