Título: COMPARAR LOS DOS ARREGLOS!! AYUDA Publicado por: JoseCheO en 10 Noviembre 2011, 03:29 am TENGO ESTE CODIGO QUE ME PERMITE INGRESAR 3 NUMERO EN CADA ARREGLO.. E IMPRIMIR LOS VALORES DE CADA UNO DE LOS ARREGLOS!
LO QUE NECESITO ES UNA FUNCION QUE ME PERMITA COMPARAR LOS ELEMENTOS DEL PRIMERO Y DEL SEGUNDO Y MOSTRAR UN ARREGLO CON LOS ELEMENTOS REPETIDOS! GRACIAS #include<iostream> using namespace std; void pedir(int matriz[3 ]) { for(int i=0; i<=2; i++) { cout << "Numero " << i<< ":? "; cin >> matriz[i ]; } } void pedirB(int matriz[3 ]) { for(int i=0; i<=2; i++) { cout << "Numero " << i<< ":? "; cin >> matriz[i ]; } } void mostrar(int matriz[3 ]) { for(int i=0; i<=2; i++) cout << matriz[i ] << " "; } void mostrarB(int matriz[3 ]) { for(int i=0; i<=2; i++) cout<<matriz[i ] << " "; } int main() { int matriz[3 ]={0},resultado[ 3]={0}; cout<<"LLENE PRIMER TABLA"<<endl; pedir(matriz); cout<<"LLENE SEGUNDA TABLA"<<endl; pedirB(matriz); cout<<"ELEMENTOS DE LA PRIMERA TABLA"<<endl; mostrar(matriz); cout<<endl; cout<<"ELEMENTOS DE LA SEGUNDA TABLA"<<endl; mostrarB(matriz); } |