fixed formatting
This commit is contained in:
parent
b37a846ed2
commit
38ec2988c9
2 changed files with 22 additions and 24 deletions
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
|
|
@ -6,5 +6,8 @@
|
||||||
"cmake.configureArgs": [
|
"cmake.configureArgs": [
|
||||||
"-DVCPKG_MANIFEST_MODE=OFF",
|
"-DVCPKG_MANIFEST_MODE=OFF",
|
||||||
"-DVCPKG_TARGET_TRIPLET=x64-linux"
|
"-DVCPKG_TARGET_TRIPLET=x64-linux"
|
||||||
]
|
],
|
||||||
|
"files.associations": {
|
||||||
|
"string.h": "c"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
33
puzzle1.c
33
puzzle1.c
|
|
@ -1,5 +1,5 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#define stringSize 20
|
#define stringSize 20
|
||||||
|
|
||||||
|
|
@ -8,38 +8,33 @@ char readChar = '0';
|
||||||
char stringOne[stringSize];
|
char stringOne[stringSize];
|
||||||
char stringTwo[stringSize];
|
char stringTwo[stringSize];
|
||||||
|
|
||||||
int readIntoList(char* stringList){
|
int readIntoList(char *stringList) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
while (1)
|
while (1) {
|
||||||
{
|
char next = getchar();
|
||||||
char next = getchar ();
|
if (next == '.') {
|
||||||
if (next == '.')
|
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
} else if (next != '\n') {
|
||||||
else if (next != '\n')
|
|
||||||
{
|
|
||||||
stringList[index] = next;
|
stringList[index] = next;
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
int main(){
|
|
||||||
printf("enter list size: \n");
|
printf("enter list size: \n");
|
||||||
|
|
||||||
scanf("%i", &listSize);
|
scanf("%i", &listSize);
|
||||||
int listOne[listSize];
|
int listOne[listSize];
|
||||||
int listTwo[listSize];
|
int listTwo[listSize];
|
||||||
|
|
||||||
memset (listOne, '\0', listSize);
|
memset(listOne, '\0', listSize);
|
||||||
memset (listTwo, '\0', listSize);
|
memset(listTwo, '\0', listSize);
|
||||||
printf ("enter list 1: \n");
|
printf("enter list 1: \n");
|
||||||
readIntoList (stringOne);
|
readIntoList(stringOne);
|
||||||
printf ("enter list 2: \n");
|
printf("enter list 2: \n");
|
||||||
readIntoList (stringTwo);
|
readIntoList(stringTwo);
|
||||||
|
|
||||||
printf ("one: %s \ntwo: %s ",stringOne,stringTwo);
|
printf("one: %s \ntwo: %s ", stringOne, stringTwo);
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue