-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo_real.cpp
52 lines (44 loc) · 956 Bytes
/
do_real.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_real_c;
extern void get_int_name();
void get_real()
{
int RIGHT_p = 0;
memset(RIGHT, 0, sizeof(RIGHT));
while ((do_real_c = getchar()) != ';')
{
if(isdigit(do_real_c)||do_real_c=='.')
RIGHT[RIGHT_p++] = do_real_c;
}
ungetc(do_real_c, stdin);
}
void do_real()
{
while ((do_real_c = getchar()) != ';')
{
ungetc(do_real_c, stdin);
get_int_name();
VariableName[name] = " real";
while ((do_real_c = getchar()) == ' ');
if (do_real_c == ',') continue;
else if (do_real_c == '=')
{
strcpy(LEFT, name);
memset(RIGHT, 0, sizeof(RIGHT));
get_real();
strcat(RIGHT, " real");
VariableName[LEFT] = RIGHT;
}
else if (do_real_c == ';') break;
}
}