problem!!!

Read the Voting results from the file which contains all the votes of the election happened inside the whole world, it includes let’s say 50 countries, in every country there are 4 provinces and in each province let say we have 5 cities and in each city we have 10 Districts and on each district there are 10 opponents who are fighting against each other.


• Task 1: Load all the Data from file into arrays prompt the user which one result you are interested in.
o Which District
o Which City
o Which Province
Which Country
What is the result of the whole world

country1Province1 country1Province2 country1Province3 country1Province4
-----------------------------------------
-----------------------------------------


country1Province1

-------------------------
country1Province1City1 country1Province1City2 country1Province1City3 country1Province1City4 country1Province1City5 country1Province1City6 country1Province1City7 country1Province1City8 country1Province1City9 country1Province1City10
-------------------------

country1Province1City1
-------------------------
country1Province1City1District1 country1Province1City1District2 country1Province1City1District3 country1Province1City1District4 country1Province1City1District5
-------------------------
country1Province1City1District1 Votes:
5 1 5 4 3 8 3 9 9 9 8 6 4 8 4 7 3 10 10 4 1 1 3 5 8 7 8 4 2 10 3 5 8 9 5 7 7 7 2 3 1 4 3 8 3 2 5 3 8 6

country1Province1City1District2 Votes:
1 3 5 10 9 1 4 1 4 10 9 8 5 4 6 9 6 6 6 5 7 9 10 9 2 9 10 3 7 10 5 3 9 9 1 4 6 9 5 5 9 10 2 9 7 6 5 2 1 10

country1Province1City1District3 Votes:
1 5 6 9 4 7 6 6 3 7 1 9 10 4 7 7 9 5 9 7 8 9 10 7 9 8 4 4 3 10 10 1 8 7 8 5 7 6 3 2 10 10 8 2 1 3 8 2 1 2

country1Province1City1District4 Votes:
5 5 1 9 4 6 8 2 1 7 6 5 8 3 8 5 10 4 1 10 2 9 7 5 10 4 1 8 7 4 4 10 4 2 3 2 5 3 9 2 5 9 1 1 7 7 7 10 5 7

country1Province1City1District5 Votes:
10 2 1 3 3 4 2 6 5 2 3 6 2 1 7 2 3 8 5 1 5 1 8 6 2 7 6 2 7 8 10 3 5 8 3 7 6 4 7 10 5 1 9 10 5 7 1 3 5 1


country1Province1City2
-------------------------
country1Province1City2District1 country1Province1City2District2 country1Province1City2District3 country1Province1City2District4 country1Province1City2District5
-------------------------
country1Province1City2District1 Votes:
3 1 4 2 3 10 2 3 3 5 2 5 7 6 10 6 7 10 7 2 10 3 8 10 4 6 7 1 7 3 4 3 5 7 5 10 1 7 10 5 3 9 3 2 10 10 5 9 3 6

country1Province1City2District2 Votes:
9 7 6 1 6 7 7 8 3 7 10 5 4 1 4 4 1 6 3 1 8 4 7 6 4 7 10 1 2 5 6 6 8 3 1 1 1 8 8 3 3 1 7 6 1 5 3 8 2 6

country1Province1City2District3 Votes:
9 4 8 7 2 6 9 5 9 7 3 2 10 9 6 1 2 2 7 8 10 3 1 2 1 10 4 5 9 8 4 8 9 10 9 4 1 8 1 2 4 6 5 5 4 7 3 4 7 4

country1Province1City2District4 Votes:
3 5 4 2 4 8 3 9 5 8 9 7 10 9 1 9 2 5 8 5 10 2 8 7 9 1 10 9 7 10 3 6 5 9 9 7 6 1 8 1 3 5 2 7 3 1 9 1 1 1

country1Province1City2District5 Votes:
4 3 2 8 6 5 7 10 7 2 1 5 2 2 10 4 6 9 7 10 8 7 4 10 5 2 3 10 2 2 3 2 4 3 5 8 5 7 6 8 2 10 1 10 1 5 1 1 4 6


country1Province1City3
-------------------------
country1Province1City3District1 country1Province1City3District2 country1Province1City3District3 country1Province1City3District4 country1Province1City3District5
-------------------------
country1Province1City3District1 Votes:
7 6 6 7 1 9 6 7 9 3 6 8 10 8 3 2 5 6 4 7 6 5 4 3 7 5 1 8 8 5 6 9 6 7 7 9 10 5 4 9 5 3 2 8 6 1 3 6 6 7

country1Province1City3District2 Votes:
6 4 9 9 10 4 10 4 4 7 9 10 6 3 9 9 10 10 9 8 5 3 1 10 4 7 3 2 4 4 4 7 5 4 1 7 7 8 10 6 3 1 4 8 1 10 7 8 6 9

country1Province1City3District3 Votes:
8 2 5 8 7 3 8 7 9 2 2 4 6 4 6 3 6 10 6 4 3 2 8 1 3 5 1 2 2 8 6 2 1 7 1 6 5 1 9 1 10 3 3 9 2 5 2 5 10 8

country1Province1City3District4 Votes:
7 3 9 1 2 3 4 6 8 10 5 10 7 7 5 6 8 3 5 5 4 6 8 9 4 4 4 3 2 9 3 1 5 7 7 7 5 4 9 4 5 7 2 9 7 1 7 10 2 4

country1Province1City3District5 Votes:
7 7 9 8 2 10 7 7 4 10 7 3 4 7 9 4 5 6 6 5 5 5 5 2 9 1 5 8 3 3 5 4 3 8 2 2 6 1 1 3 6 10 8 3 3 7 4 3 5 6

and it is going on
i have done this far!!!!
#include<iostream>
#include<fstream>

using namespace std;

void LoadACountry(char CountryFileName[100],int CountryIndex,
char AllProvinces[50][4][20], char AllCities[50][4][10][20],char AllDistricts[50][4][10][5][20],char AllVotes[50][4][10][5][50])

fstream CReader(CountryFileName,ios::in);

for(int pi = 0;pi<4;pi++)
{
CReader>>AllProvinces[CountryIndex][pi];
}

char A[100];


CReader.getline(A,100);
CReader.getline(A,100);
CReader.getline(A,100);

for(pi = 0;pi<4;pi++)
{

CReader.getline(A,100);
CReader.getline(A,100);
CReader.getline(A,100);
CReader.getline(A,100);
CReader.getline(A,100);

for(int ci = 0; ci<10;ci++)
{
CReader>>AllCities[CountryIndex][pi][ci];
CReader.getline(A,100);
CReader.getline(A,100);
CReader.getline(A,100);
CReader.getline(A,100);
for(int ei = 0; ei<5;ei++)
{
CReader>>AllDistricts[CountryIndex][pi][ci][ei];
CReader.getline(A,100);
CReader.getline(A,100);
for(int fi = 0; fi<10;fi++)
{
CReader>>AllVotes[CountryIndex][pi][ci][ei][fi];
}

}
}
}

}
void main()
{


char CountriesName[50][20];
char AllProvinces[50][4][20];
char AllCities[50][4][10][20];
char AllDistricts[50][4][10][5][20];
char AllVotes[50][4][10][5][50];

fstream WReader("World.txt",ios::in);


for(int i=0;i<50;i++)
{
WReader>>CountriesName[i];
}


for(int c = 0; c<50;c++)
{
char A[100] = {"World/"};

strcat(A,CountriesName[c]);
strcat(A,".txt");

LoadACountry( A, c, AllProvinces,AllCities,Alldistricts,Allvotes);
}

}
Topic archived. No new replies allowed.