Write a C++ function (call it search) that searches for a number in the array, that is passed to the function, and returns the index/indices of the number in that array. For example, if you pass [5,6,8,9,5,2] to the function and you want to search for 5 the function returns [0,4]. Write a C++ program and test your function. Take the following notes into consideration when writing your program:
1- Let the user decide the size of the array and then enter the array elements.
2- Your function should work with any data type.
3- Use pass by address when passing the array to the function.
4.The function should prevent changing the elements of the passed array.
السؤال
Aya alsalam
السلام عليكم
ارجو حل هذا السؤال
Write a C++ function (call it search) that searches for a number in the array, that is passed to the function, and returns the index/indices of the number in that array. For example, if you pass [5,6,8,9,5,2] to the function and you want to search for 5 the function returns [0,4]. Write a C++ program and test your function. Take the following notes into consideration when writing your program:
1- Let the user decide the size of the array and then enter the array elements.
2- Your function should work with any data type.
3- Use pass by address when passing the array to the function.
4.The function should prevent changing the elements of the passed array.
تنسيق العنوان
رابط هذا التعليق
شارك على الشبكات الإجتماعية
2 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.