-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPSP1.cpp
More file actions
69 lines (62 loc) · 2.26 KB
/
Copy pathPSP1.cpp
File metadata and controls
69 lines (62 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include "Lectura.h"
#include <vector>
using namespace std;
string getClassName(string file){
file.erase(file.find('.'), (file.find('.') - file.length()));
return file;
}
int main(){
vector<string> file;
string nameFile = "adada";
int count = -1;
int totalSum = 0;
int numberOfClasses = 0;
while(nameFile.length() != 0){
getline(cin, nameFile);
file.push_back(nameFile);
count++;
}
numberOfClasses = count;
for(int i = 0; i<count; i++){
for(int j = i + 1; j<count; j++){
if(getClassName(file[i]) == getClassName(file[j])){
numberOfClasses--;
}
}
}
Lectura lectura[numberOfClasses];
for(int i = 0, j = 0; i<count; i++, j++){
if(i != 0 && getClassName(file[i]) == getClassName(file[i-1])){
j--;
}
lectura[j].Calcula(file[i]);
}
cout<<"CLASES BASE:"<<endl;
for(int i = 0; i<numberOfClasses; i++){
if(lectura[i].getType() == "Base"){
cout<<" "<<getClassName(file[i])<<": T="<<lectura[i].getTotalLDC()<<", I="<<lectura[i].getItems()<<", B="<<lectura[i].getBaseLDC()<<
", D="<<lectura[i].getDeletedLDC()<<", M="<<lectura[i].getModifiedLDC()<<", A="<<lectura[i].getAddedLDC()<<endl;
totalSum = totalSum + lectura[i].getTotalLDC();
}
}
cout<<"--------------------------------------"<<endl;
cout<<"CLASES NUEVAS:"<<endl;
for(int i = 0; i<numberOfClasses; i++){
if(lectura[i].getType() == "Nueva"){
cout<<" "<<getClassName(file[i])<<": T="<<lectura[i].getTotalLDC()<<", I="<<lectura[i].getItems()<<endl;
totalSum = totalSum + lectura[i].getTotalLDC();
}
}
cout<<"--------------------------------------"<<endl;
cout<<"CLASES REUSADAS"<<endl;
for(int i = 0; i<numberOfClasses; i++){
if(lectura[i].getType() == "Reusada"){
cout<<" "<<getClassName(file[i])<<": T="<<lectura[i].getTotalLDC()<<", I="<<lectura[i].getItems()<<", B="<<lectura[i].getBaseLDC()<<endl;
totalSum = totalSum + lectura[i].getTotalLDC();
}
}
cout<<"--------------------------------------"<<endl;
cout<<"Total de LDC= "<<totalSum<<endl;
return 0;
}