+ 1

Arrays

I need to make 3 functions: one to fill in an array another one is to print that array and the last one is to indicate how many values of that array are bigger than 32. Anyone able to help?

11th Apr 2019, 6:13 AM
Nabster
Nabster - avatar
2 ответов
+ 1
~ swim ~ here's the code I thought of without functions. #include<iostream> using namespace std; int main() { int n,cont=0; cout<<"How big is the array? "<<endl; cin>>n; cout<<"Insert the values of the array: "<<endl; int v[n]; for(int i;i<n;i++) { cin>>v[i]; if(v[i]>32) { cont++; } } for(int i;i<n;i++) { cout<<v[i]; } cout<<"There are "<<cont<<" values that are bigger than 32"<<endl; return 0; }
11th Apr 2019, 8:57 AM
Nabster
Nabster - avatar
0
I have and spent 3 hours trying to figure this apparently simple problem but I just can't find the solution. My idea was to make a function to fill the array, return the array then make another function to get that array and output it then make another function that gets it and checks if every value of the array is greater than 32
11th Apr 2019, 6:57 AM
Nabster
Nabster - avatar