Aktualizovat „du4/program.c“

This commit is contained in:
Bohdan Yanchyk 2020-04-02 23:45:12 +00:00
parent ce16210809
commit fcfe4f3939

View File

@ -1,11 +1,3 @@
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h> #include <stdio.h>
#include<string.h> #include<string.h>
#include<math.h> #include<math.h>
@ -61,11 +53,17 @@ int main()
{ {
char str[100][100]; char str[100][100];
int i =0; int i =0;
for(;i<100;i++){ int j =0;
scanf("%s",str[i]); while((c=getchar())!=EOF){
} if(c=='\n'){
j=0;
i++;
}
str[i][j]=c;
j++;
}
for(int k=0;k<i;k++){ for(int k=0;k<i;k++){
char *new_str = compactString(str,strlen(str)); char *new_str = compactString(str[i],strlen(str));
double first =-5,second =-5,res=-5; double first =-5,second =-5,res=-5;
char c='E'; char c='E';
sscanf(new_str,"%lf%c%lf%*[=]%lf",&first,&c,&second,&res); sscanf(new_str,"%lf%c%lf%*[=]%lf",&first,&c,&second,&res);
@ -85,4 +83,4 @@ int main()
} }
return 0; return 0;
} }