added another part of the code, attempt at recreating https://git.dvorakmortonxd.dev/dvorakmortonxd/DvorakMSDOS later on, added a space to help with consistency
This commit is contained in:
parent
b8ab6baa8b
commit
74792b7786
5 changed files with 20 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -57,6 +57,7 @@ dkms.conf
|
||||||
|
|
||||||
# Binary
|
# Binary
|
||||||
main
|
main
|
||||||
|
dvorakmsdos
|
||||||
|
|
||||||
# debug information files
|
# debug information files
|
||||||
*.dwo
|
*.dwo
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,6 @@ project(my_own_study_c_repo C)
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
|
||||||
add_executable(my_own_study_c_repo
|
add_executable(my_own_study_c_repo
|
||||||
main.c)
|
main.c
|
||||||
|
dvorakmsdos.c
|
||||||
|
dvorakmsdos.h)
|
||||||
|
|
|
||||||
6
dvorakmsdos.c
Normal file
6
dvorakmsdos.c
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include "dvorakmsdos.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void msmain() {
|
||||||
|
printf("Hello World!\n");
|
||||||
|
}
|
||||||
4
dvorakmsdos.h
Normal file
4
dvorakmsdos.h
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
#ifndef MY_OWN_STUDY_C_REPO_DVORAKMSDOS_H
|
||||||
|
#define MY_OWN_STUDY_C_REPO_DVORAKMSDOS_H
|
||||||
|
void msmain();
|
||||||
|
#endif //MY_OWN_STUDY_C_REPO_DVORAKMSDOS_H
|
||||||
9
main.c
9
main.c
|
|
@ -3,6 +3,7 @@
|
||||||
//importing basic modules
|
//importing basic modules
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "dvorakmsdos.h"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#define GETCH() _getch()
|
#define GETCH() _getch()
|
||||||
|
|
@ -143,6 +144,7 @@ int main() {
|
||||||
|
|
||||||
// PRESS ANY KEY TO CONTINUE
|
// PRESS ANY KEY TO CONTINUE
|
||||||
printf("\n\nPress any key to continue...");
|
printf("\n\nPress any key to continue...");
|
||||||
|
fflush(stdout); // this forces the buffer to print NOW, fixing the "bug" in which it prints out everything AFTER the next line (scanf)
|
||||||
GETCH();
|
GETCH();
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
system("cls");
|
system("cls");
|
||||||
|
|
@ -154,7 +156,7 @@ int main() {
|
||||||
printf("\n\nINPUT BELOW:\n"); // DIVIDER
|
printf("\n\nINPUT BELOW:\n"); // DIVIDER
|
||||||
char fruit[50]; //MAX 50 CHARACTERS
|
char fruit[50]; //MAX 50 CHARACTERS
|
||||||
printf("Pick a fruit (SINGLE WORD, EVERYTHING ELSE GETS IGNORED): ");
|
printf("Pick a fruit (SINGLE WORD, EVERYTHING ELSE GETS IGNORED): ");
|
||||||
fflush(stdout); // this forces the buffer to print NOW, fixing the "bug" in which it prints out everything AFTER the next line (scanf)
|
fflush(stdout); // same use case as above in the first input part of the code
|
||||||
scanf("%s", fruit);
|
scanf("%s", fruit);
|
||||||
printf("\nYou choose %s as your fruit!", fruit);
|
printf("\nYou choose %s as your fruit!", fruit);
|
||||||
|
|
||||||
|
|
@ -165,7 +167,7 @@ int main() {
|
||||||
fflush(stdout); // same use case as above in the first input part of the code
|
fflush(stdout); // same use case as above in the first input part of the code
|
||||||
while (getchar() != '\n') {} // clears the input buffer so it doesnt print out excess input from the fruit one
|
while (getchar() != '\n') {} // clears the input buffer so it doesnt print out excess input from the fruit one
|
||||||
scanf(" %49[^\n]", vegetable); // the "[^\n]" means to read everything except a newline, which means you can input spaces inside now, 49 makes it so it doesnt crash once it has more than 50 characters
|
scanf(" %49[^\n]", vegetable); // the "[^\n]" means to read everything except a newline, which means you can input spaces inside now, 49 makes it so it doesnt crash once it has more than 50 characters
|
||||||
printf("The %s will be a perfect choice for this salat!", vegetable);
|
printf("\nThe %s will be a perfect choice for this salat!", vegetable);
|
||||||
|
|
||||||
// END OF THE MAIN.C CODE, HERE YOU WILL BE ABLE TO CONTINUE ON TO OTHER EXPERIMENTS OF MINE
|
// END OF THE MAIN.C CODE, HERE YOU WILL BE ABLE TO CONTINUE ON TO OTHER EXPERIMENTS OF MINE
|
||||||
printf("\n\nSWITCH OVER TO\n"); // DIVIDER
|
printf("\n\nSWITCH OVER TO\n"); // DIVIDER
|
||||||
|
|
@ -175,7 +177,8 @@ int main() {
|
||||||
fflush(stdout); // same use case as above in the first input part of the code
|
fflush(stdout); // same use case as above in the first input part of the code
|
||||||
char chc = GETCH();
|
char chc = GETCH();
|
||||||
if (chc == '1') {
|
if (chc == '1') {
|
||||||
printf("placeholder");
|
msmain(); // calls dvorakmsdos.c
|
||||||
|
return 0;
|
||||||
} else if (chc == '2') {
|
} else if (chc == '2') {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue