Created
December 6, 2013 21:52
-
-
Save chukitow/7832731 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<fstream> | |
using namespace std; | |
void determinarRangos(int[10], int); | |
int main() | |
{ | |
int contador[10] = {0}; | |
int rangos [10]; | |
int extensionRango = 0; | |
int numero; | |
//Determinar los rangos de numeros | |
ifstream limites("C:\\Users\\Ivan Velasquez Rios\\Desktop\\Examen\\limites.txt"); | |
if(!limites) | |
{ | |
cout<<"Error"<<endl; | |
} | |
else | |
{ | |
while (!limites.eof()) | |
{ | |
limites >> rangos[extensionRango]; | |
extensionRango++; | |
} | |
rangos[extensionRango] = 100000; | |
limites.close(); | |
} | |
ifstream numeros("C:\\Users\\Ivan Velasquez Rios\\Desktop\\Examen\\numeros.txt"); | |
if(!numeros) | |
{ | |
cout<<"Error al leer los numeros"<<endl; | |
} | |
else | |
{ | |
while (!numeros.eof()) | |
{ | |
numeros >> numero; | |
bool ban = false; | |
int i=0; | |
while(ban==false) | |
{ | |
if(numero<=rangos[i]) | |
{ | |
contador[i]++; | |
ban = true; | |
} | |
i++; | |
} | |
} | |
numeros.close(); | |
} | |
for(int j=0;j<=extensionRango;j++) | |
{ | |
cout<<"El numero del rango "<<j+1<<" se repite " << contador[j] << " tantas veces"<<endl; | |
} | |
cin.get(); | |
cin.get(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment