Yurttas/PL/OOL/Cplusplus/F/02/04/03/01/assign string 00.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 1998
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this 
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this 
 8   copyright notice appears in all copies. 
 9 
10   date   : January 1, 1998.
11   author : Salih Yurttas.
12
13   assign_string_00.cpp
14*/
15
16
17#include <cstring>
18
19using namespace std;
20
21extern char* get_string_value();
22
23extern void put_string_value(char*);
24
25extern void put_string_count(char*, int);
26
27int main(int argc, char* argv[]) {
28
29  char* a = get_string_value();
30
31  put_string_value(a);
32
33  int i = strlen(a);
34
35  put_string_count(a,
36                   i);
37
38  char* b = get_string_value();
39
40  put_string_value(b);
41
42  i = strlen(b);
43
44  put_string_count(b,
45                   i);
46
47  strcpy(a,b);
48
49  put_string_value(a);
50
51  i = strlen(a);
52
53  put_string_count(a,
54                   i);
55
56}