help with a function. I'm trying to use the function bubblesort to sort my values in the array positive_num. can somebody please tell me what I'm doing wrong? thanks!
If I understand correctly, you want to print four numbers per line? You could use an integer count. Add 1 to it each time a number is printed. When it reaches 4, output a newline and reset the count to zero. (could also use the modulo operator % in similar code).
can somebody help me build a function please? I want to take the code for my numbers out of the get_data function and make a separate function for them.
I suggest you think in terms of describing in words what the various parts of the program need to be. Don't worry about the code. For example there are various activities which seem separate and unrelated, those might be candidates for separate functions. (though some might be merged together).
examples:
• get names of files as input from user
• read from input file into an array
carry out various actions using the array contents:
• negative numbers
• positive numbers
• prime numbers
• statistics
Those are just ideas, don't take them as fixed in any way. Some may need further subdivision, for example testing whether a number is prime.
Then the main() function would consist of calling some of these functions directly, so that reading through main() gives one a good idea of what the program is trying to achieve, while the details are contained in their own functions.