-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo_string.cpp
52 lines (45 loc) · 1 KB
/
do_string.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
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
#include "do_int.h"
#include "do_string.h"
#include <map>
extern map<string, string> VariableName;
extern char str1[10];
extern char name[10];
extern char LEFT[10];
extern char RIGHT[10];
char do_string_c;
extern void get_int_name();
void get_string()
{
int RIGHT_p= 0;
memset(RIGHT, 0, sizeof(RIGHT));
while ((do_string_c = getchar()) != '"');
while ((do_string_c = getchar()) != '"')
{
RIGHT[RIGHT_p++] = do_string_c;
}
while ((do_string_c = getchar()) != ';');
ungetc(do_string_c, stdin);
}
void do_string()
{
while ((do_string_c = getchar()) != ';')
{
ungetc(do_string_c, stdin);
get_int_name();
VariableName[name] = " string";
while ((do_string_c = getchar()) == ' ');
if (do_string_c == ',') continue;
else if (do_string_c == '=')
{
strcpy(LEFT, name);
memset(RIGHT, 0, sizeof(RIGHT));
get_string();
strcat(RIGHT, " string");
VariableName[LEFT] = RIGHT;
}
else if (do_string_c == ';') break;
}
}