fixed scanf-test

This commit is contained in:
Christoph J. Scherr 2022-11-24 21:39:41 +01:00
parent a37103e1fc
commit fb0938d2c3
5 changed files with 14 additions and 8 deletions

4
.gitignore vendored
View File

@ -50,3 +50,7 @@ modules.order
Module.symvers Module.symvers
Mkfile.old Mkfile.old
dkms.conf dkms.conf
# project specific for c-basic
huffman/testfiles/*
huffman/testfiles/

BIN
bin/scanf-test Executable file

Binary file not shown.

View File

@ -1,2 +1,3 @@
#!/bin/bash #!/bin/bash
echo "compiling all files in working directory $(pwd)"
for file in $(/bin/ls); do ./compile.sh $file; done for file in $(/bin/ls); do ./compile.sh $file; done

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
name=$(echo "$1" | cut -f 1 -d '.') noext=$(echo "$1" | cut -f 1 -d '.')
gcc $1 -o bin/$noext gcc $1 -o bin/$noext
./bin/$noext $2 $3 $4 $5 $6 $7 $8 $9 ./bin/$noext $2 $3 $4 $5 $6 $7 $8 $9

View File

@ -1,10 +1,11 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
int a; int a;
float f; float f;
char s[20]; char s[20];
scanf("%d %f %s", &a, &f, s); printf("input an integer, a float, then a string.\n");
printf("%d %f %s\n", a, f, s); scanf("%d %f %s", &a, &f, s);
return 0; printf("%d %f %s\n", a, f, s);
\n} return 0;
}