Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
cpp ex 3 - solution
//Title of this code #include <iostream> #include <cstdlib> #include <ctime> #include <string.h> #define numberOfElements 10 using namespace std; void acquireArray(int array[numberOfElements]); void stampaArray(int array[numberOfElements]); void acquireValue(int value); void stampaValue(int value); void controleValueOnArray(int array[numberOfElements], int value); int main() { int array[numberOfElements]; int value; acquireArray(array); cout << "L'array e' composto dai seguenti numeri: " << endl; stampaArray(array); cin >> value; cout << "Il valore e': " << endl; stampaValue(value); cout << endl; cout << "L'array dopo il controllo e': " << endl; controleValueOnArray(array, value); stampaArray(array); } void acquireArray(int array[numberOfElements]) { for(int i=0; i < numberOfElements; i++) { cin >> array[i]; } } void stampaArray(int array[numberOfElements]) { for(int i=0; i < numberOfElements; i++) { cout << array[i] << endl; } } void stampaValue(int value) { cout << value; } void controleValueOnArray(int array[numberOfElements], int value) { int temp=0; for(int i=0; i < numberOfElements; i++) { if(value == array[i]) { array[i]=0; while(i < numberOfElements) { temp= array[i]; array[i]= array[i+1]; array[i+1] = temp; ++i; } } } }
run
|
edit
|
history
|
help
0
is_num_palindrom
Classes Pt 2 c++
4C test
Making pyramid using nested loop 1/2
fibonacci
Anziktet
ExtremeValues
Microsoft - # of fragments (semi-optimised)
Bad palindrom
2015(M2)Mod.