main.cpp:1:10:fatal error: "IntGrande.h" file not found
Publicado por camila49 (2 intervenciones) el 13/09/2020 16:59:16
hola, estoy realizando un código pero me sale ese error y no sé por qué porque ayer que lo probaba en la casa de una amiga me corría, y también lo probábamos en replit.
main.cpp
intgrande.cpp
intgrande.h
main.cpp
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
#include "IntGrande.h"
int main()
{
IntGrande n1(4231765);
IntGrande n2(3456298);
IntGrande n3("45353564636363636363");
IntGrande n4("1");
IntGrande n5;
cout<<"\nn1 es "<<n1;
cout<<"\nn2 es "<<n2;
cout<<"\nn3 es "<<n3;
cout<<"\nn4 es "<<n4;
cout<<"\nn5 es "<<n5;
n5 = n1 + n2;
cout<<"\n\n"<<n1<<" + "<<n2<<" = "<<n5;
cout<<"\n\n"<<n3<<" + "<<n4<<" = "<<(n3 + n4);
n5 = n1 + 9;
cout<<"\n\n"<<n1<<" + "<<9<<" = "<<n5;
n5 = n2 + "2000";
cout<<"\n\n"<<n2<<" + "<<"2000"<<" = "<<n5<<"\n\n";
return 0;
}
intgrande.cpp
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 "intgrande.h"
IntGrande::IntGrande(long valor)
{
for(int i = 0; i <= 29; i++)
entero[i] = 0;
for(int j = 29; valor != 0 && j >= 0; j--){
entero[j] = valor % 10;
valor /= 10;
}
}
IntGrande::IntGrande(const char *cadena)
{
for(int i = 0; i <= 29; i++)
entero[i] = 0;
int longitud = strlen(cadena);
for(int j = 30 - longitud, k = 0; j <= 29; j++, k++)
if (isdigit(cadena[k]))
entero[j] = cadena[k] - '0';
}
IntGrande IntGrande::operator+(const IntGrande &op2)
{
IntGrande temp;
int acarreo = 0;
for(int i = 29; i >= 0; i--){
temp.entero[i] = entero[i] + op2.entero[i] + acarreo;
if(temp.entero[i] > 9){
temp.entero[i] %= 10;
acarreo = 1;
}
else
acarreo = 0;
}
return temp;
}
IntGrande IntGrande::operator+(int op2)
{
return *this + IntGrande(op2);
}
IntGrande IntGrande::operator+(const char *op2)
{
return *this + IntGrande(op2);
}
ostream& operator<<(ostream &salida, const IntGrande &num)
{
int i;
for(i = 0; (num.entero[i] == 0) && (i <= 29); i++);
if(i == 30)
salida<<0;
else
for( ; i <=29; i++)
salida<<num.entero[i];
return salida;
}
intgrande.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#ifndef INTGRANDE_H
#define INTGRANDE_H
#include <iostream>
#include <cctype>
#include <cstring>
using namespace std;
class IntGrande{
friend ostream &operator<<(ostream &, const IntGrande &);
public:
IntGrande(long = 0);
IntGrande(const char *);
IntGrande operator+(const IntGrande &);
IntGrande operator+(int);
IntGrande operator+(const char *);
private:
short entero[30];
};
#endif // INTGRANDE_H
Valora esta pregunta
0