forked from NUDT-compiler/nudt-compiler-cpp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.0 KiB
67 lines
1.0 KiB
#include "sylib.h"
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
static float ReadFloatToken(void) {
|
|
char buffer[128] = {0};
|
|
if (scanf("%127s", buffer) != 1) {
|
|
return 0.0f;
|
|
}
|
|
return strtof(buffer, NULL);
|
|
}
|
|
|
|
int getint(void) {
|
|
int value = 0;
|
|
scanf("%d", &value);
|
|
return value;
|
|
}
|
|
|
|
int getch(void) {
|
|
return getchar();
|
|
}
|
|
|
|
float getfloat(void) { return ReadFloatToken(); }
|
|
|
|
int getarray(int a[]) {
|
|
int n = getint();
|
|
for (int i = 0; i < n; ++i) {
|
|
a[i] = getint();
|
|
}
|
|
return n;
|
|
}
|
|
|
|
int getfarray(float a[]) {
|
|
int n = getint();
|
|
for (int i = 0; i < n; ++i) {
|
|
a[i] = getfloat();
|
|
}
|
|
return n;
|
|
}
|
|
|
|
void putint(int x) { printf("%d", x); }
|
|
|
|
void putch(int x) { putchar(x); }
|
|
|
|
void putfloat(float x) { printf("%a", x); }
|
|
|
|
void putarray(int n, int a[]) {
|
|
printf("%d:", n);
|
|
for (int i = 0; i < n; ++i) {
|
|
printf(" %d", a[i]);
|
|
}
|
|
putchar('\n');
|
|
}
|
|
|
|
void putfarray(int n, float a[]) {
|
|
printf("%d:", n);
|
|
for (int i = 0; i < n; ++i) {
|
|
printf(" %a", a[i]);
|
|
}
|
|
putchar('\n');
|
|
}
|
|
|
|
void starttime(void) {}
|
|
|
|
void stoptime(void) {}
|