Initializacia
This commit is contained in:
parent
3cbf4047a2
commit
f406e24e0c
BIN
cv3/program
Executable file
BIN
cv3/program
Executable file
Binary file not shown.
37
cv3/program.c
Normal file
37
cv3/program.c
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include<stdio.h>
|
||||||
|
#include<stdlib.h>
|
||||||
|
|
||||||
|
#define LINE_SIZE 100
|
||||||
|
#define STACK_SIZE 100
|
||||||
|
|
||||||
|
struct stack{
|
||||||
|
float values[LINE_SIZE];
|
||||||
|
int size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_stack(struct stack* stack){
|
||||||
|
for (int i = 0; i < stack->size; i++){
|
||||||
|
printf("%.0f", stack->values[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
char input[LINE_SIZE]; float y;
|
||||||
|
memset(&mystack, 0, sizzeof(struct stack));
|
||||||
|
|
||||||
|
while(fgets(input, LINE_SIZE, stdin) != NULL){
|
||||||
|
input[strlen(input - 1)] = '\0';
|
||||||
|
if(sscanf(input, "\f", &y) == 1){
|
||||||
|
printf("Success!\n");
|
||||||
|
assert(mystack.size < STACK_SIZE);
|
||||||
|
mystack.values[mystack.size] = y;
|
||||||
|
mystack.size ++;
|
||||||
|
} esle{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
print_stack(&mystack);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
0
cv4/program.c
Normal file
0
cv4/program.c
Normal file
Loading…
Reference in New Issue
Block a user