Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Autor: Joel Cesar Fernandez Segura
- Fecha: 28/08/2014
- Tema: Vectores y Arreglos
- */
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- void mostrarArray(int []);
- int main(void){
- int array[10];
- int positivos=0,negativos=0,ceros=0;
- system("color 0a");
- cout<<"\n\t\t [ VECTORES EN C++ ]\n\n";
- cout<<"\n[EJERCICIO #2]\n";
- cout<<"\nCALCULA CUANTOS NUMEROS SON POSITIVOS NEGATIVOS Y CEROS\n\n";
- for(int i=0;i<10;i++){
- cout<<"INGRESE ELEMENTO ["<<i+1<<"]:";
- cin>>array[i];
- }
- cout<<"\n\nEL ARREGLO ES :\n";
- mostrarArray(array);
- cout<<endl<<endl<<endl;
- for(int i=0;i<10;i++){
- if(array[i]>0) positivos++;
- else if(array[i]<0) negativos++;
- else ceros++;
- }
- cout<<"CANTIDAD DE ELEMENTOS POSITIVOS : "<<positivos<<endl<<endl;
- cout<<"CANTIDAD DE ELEMENTOS NEGATIVOS : "<<positivos<<endl<<endl;
- cout<<"CANTIDAD DE ELEMENTOS CON VALOR CERO : "<<ceros<<endl<<endl;
- return 0;
- }
- void mostrarArray(int array[]){
- for(int i=0;i<10;i++){
- cout<<array[i]<<" ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement