Professional Documents
Culture Documents
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <stdio.h>
#include <cstdlib>
#include <stdlib.h>
#define N 20000
#define numberOfRows 2
#define numberOfCol 9
int main()
{
//***************************************************************************
********************//
int maxrows = 2, maxcolums = 4;//the variables that dont fill the collums has
to be zero
string tablep[2][9];
string f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
int positionLine = 0, positionCol = 0;
string rows[numberOfRows], collums[numberOfCol];
int finalTable[numberOfRows][numberOfRows];//all to be zero i have to
inizializw that
fstream finalFile;
finalFile.open("asasasas.txt");
int poss = 0;
if (finalFile.is_open())
{
while (!finalFile.eof())
{
getline(finalFile, f1, ',');
cout << "f1 is : " << f1 << '\n';
getline(finalFile, f2, ',');
cout << "f2 is : " << f2 << '\n';
getline(finalFile, f3, ',');
cout << "f3 is : " << f3 << '\n';
getline(finalFile, f4, ',');
cout << "f4 is : " << f4 << '\n';
getline(finalFile, f5, ',');
cout << "f5 is : " << f5 << '\n';
getline(finalFile, f6, ',');
cout << "f6 is : " << f6 << '\n';
getline(finalFile, f7, ',');
cout << "f7 is : " << f7 << '\n';
getline(finalFile, f8, ',');
cout << "f8 is : " << f8 << '\n';
getline(finalFile, f9, ',');
cout << "f9 is : " << f9 << '\n';
getline(finalFile, f10, '\n');
//cout << "f11 is : " << f10 << '\n';
tablep[poss][0] = f2;
tablep[poss][1] = f3;
tablep[poss][2] = f4;
tablep[poss][3] = f5;
tablep[poss][4] = f6;
tablep[poss][5] = f7;
tablep[poss][6] = f8;
tablep[poss][7] = f9;
tablep[poss][8] = f10;
poss++;
}
}
else
{
cout << "cant open file";
}
if (tablepp[j].compare(tablep[u][uu]) == 0) {
// cout <<
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" << '\n';
found = 0;
}
}
if (found == 1) {
if (atoi(tablep[u][uu].c_str()) != 0) {
tablepp[uuu] = tablep[u][uu];
uuu++;
}
}
found = 1;
}
}
}
for (int l = 0; l < 100; l++) {
if (atoi(tablepp[l].c_str()) != 0) {
cout << tablepp[l] << endl;
}
}
cout << "before " << tablep[0][1] << endl;
//***************************************************************************
***********************************************************
finalFile.close();
cout << "before " << tablep[0][1] << endl;
int positionline = 0;
int finaltable[100][100] ;
int j = 0;
/*for (int l = 0; l <100; l++) {
for (int m = 0; m < 100; m++) {
finalTable[l][m] = 0;
}
}*/
if (tablep[k][i].compare(tablepp[j]) == 0)
{
if (atoi(tablepp[j].c_str()) != 0) {
positionline = j;
}
}
for (int l = 0; l<9; l++)
{
if (l != j)
{
for (int a = 0; a<numberOfCol; a++)
{
for (int aa = 0; aa < 100; aa++) {
if (atoi(tablep[k][a].c_str()) !=
0) {
if (tablep[k]
[a].compare(tablepp[aa]) == 0)
{
finaltable[j][aa] =
finaltable[j][aa] + 1;
break;
}
}
}
}
}
}
}
}
}
for (int l = 0; l <8; l++) {
for (int m = 0; m < 8; m++) {
cout << finalTable[l][m] << '\t';
}
cout << endl;
}
//*********************************************************************************
***************//
if (number == atoi(tablepp[i].c_str()) == 0) {
position = i;
}
}
}
return position;
}