I can't find my errors

I started programming just few months ago.
I have an important project soon, so I programmed one so hard(helped by many people also)
anyway, I can't find my errors.
this program is changing DNA.

for example)
agct -> gtca (for random)

my computer says "'sth' was not declared in this scope."
can anyone find out the wrong parts? ;(


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
70
71
72
73
74
75
76
77
78
 #include<iostream>
#include<ctime>

using namespace std;

class DNA
{
private:
char *dna;
char *dna2;  //declared same dna appoint them for random
int length;
int *except;

public:

DNA(char *dna)
{
this->length = strlen( dna);
   this->dna = new char[this->length];
strcpy(this->dna, dna);

}

void ChangeDNA()
{
this->dna2 = new char[this->length];
strcpy(this->dna2, this->dna); 
this->except = new int[this->length];
bool on = true; 

for (int i = 0; i < this->length; i++)
{


int random = rand() % this->length;//set the array value of dna2 which put in dna
this->except[i] = random;  //avoid same array value

for (int i2 = 0; i2 < i; i2++)
{

if (this->except[i2] == random)
{
on = false;
break;
}
}



if (on == true)
{
this->dna[i] = this->dna2[random]; //change dna's name randomly
}
else             
{
on = true;
i--;
}
}
}
void show()
{
cout << "dna: " << this->dna << endl;
}
};
void main()
{
srand((unsigned int)time(NULL));//

char *dna=new char[100];//
cout << "put dna: ";
cin >> dna;      // 
DNA d(dna);      //
    d.ChangeDNA();   //
d.show();        //

delete[]dna; //
}
Last edited on
this is what my computer says
C:\Users\sec\Desktop\changing dna.cpp In constructor 'DNA::DNA(char*)':
18 27 C:\Users\sec\Desktop\changing dna.cpp [Error] 'strlen' was not declared in this scope
20 22 C:\Users\sec\Desktop\changing dna.cpp [Error] 'strcpy' was not declared in this scope
C:\Users\sec\Desktop\changing dna.cpp In member function 'void DNA::ChangeDNA()':
27 29 C:\Users\sec\Desktop\changing dna.cpp [Error] 'strcpy' was not declared in this scope
35 19 C:\Users\sec\Desktop\changing dna.cpp [Error] 'rand' was not declared in this scope
C:\Users\sec\Desktop\changing dna.cpp At global scope:
66 11 C:\Users\sec\Desktop\changing dna.cpp [Error] '::main' must return 'int'
C:\Users\sec\Desktop\changing dna.cpp In function 'int main()':
68 31 C:\Users\sec\Desktop\changing dna.cpp [Error] 'srand' was not declared in this scope
yes!! thankyou :D I found another problem but I solved those problems..!
yess that was the new problem I found. thankyou so much ;(
Topic archived. No new replies allowed.