Enter a kind of animal

 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
#include <windows.h>
#include <cstdlib>
#include <iostream>
#include <string.h>
#include <stdio.h>
//Rusifikator
char bufrus[256];char*rus(const char*text){CharToOem(text,bufrus);return bufrus;}
using namespace std;
int main(int argc, char *argv[])
{
char animal[20]="bear";
char*ps;
char *bird="woron";
char flower[10]="rose";
cout << flower << "s are red'n";
cout << animal << " and ";
cout << bird << "n";
cout<<ps<<"\n";
cout<<"Enter a kind of animal";
cin>>animal;
ps=animal;
cout<<ps<<"S!\n";
cout<<"before using strcpy():\n";
cout<<animal<<" at "<<(int*)animal<<endl;
cout<<ps<<" at "<<(int*)ps<<endl;
ps=new char[strlen(animal)+1];
strcpy(ps,animal);
cout << "After using strcpy():\n";
cout << animal << " at "<<(int*)animal<<endl;
printf("%lx\n",(int*)animal);
cout << ps << " at "<< (int*)ps<<endl;
delete[]ps;
return 0;
}
//Create::Autospelestoluh_Kas::autospelestoluh@mail.ru::622411&527916][2007]