int main() { int N; std::cout << "Enter the size of the array: "; std::cin >> N;
std::vector<int> arr(N); std::cout << "Enter the elements of the array: "; for(int i = 0; i < N; i++) { std::cin >> arr[i]; } // Find minimum element in the array int minElement = arr[0]; for (int i = 1; i < N; i++) { if (arr[i] < minElement) { minElement = arr[i]; } } // Remove all occurrences of minimum element from the array std::vector<int> resultArr; for (int i = 0; i < N; i++) { if (arr[i] != minElement) { resultArr.push_back(arr[i]); } } // Output the size of the resulting array std::cout << "Size of the resulting array: " << resultArr.size() << std::endl; // Output the elements of the resulting array std::cout << "Elements of the resulting array: "; for (int i = 0; i < resultArr.size(); i++) { std::cout << resultArr[i] << " "; } return 0;
int main() {
std::vector<int> arr(N);int N;
std::cout << "Enter the size of the array: ";
std::cin >> N;
std::cout << "Enter the elements of the array: ";
for(int i = 0; i < N; i++) {
std::cin >> arr[i];
}
// Find minimum element in the array
int minElement = arr[0];
for (int i = 1; i < N; i++) {
if (arr[i] < minElement) {
minElement = arr[i];
}
}
// Remove all occurrences of minimum element from the array
std::vector<int> resultArr;
for (int i = 0; i < N; i++) {
if (arr[i] != minElement) {
resultArr.push_back(arr[i]);
}
}
// Output the size of the resulting array
std::cout << "Size of the resulting array: " << resultArr.size() << std::endl;
// Output the elements of the resulting array
std::cout << "Elements of the resulting array: ";
for (int i = 0; i < resultArr.size(); i++) {
std::cout << resultArr[i] << " ";
}
return 0;
}