#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// tiny_virus.c
// Copyright (c) @Sealington 2023
// Licensed under M.I.T
// ------------------------------
int main() {
// memory allocation
size_t size_in_bytes = 5 * 1024 * 1024; // 5mb
char *data = (char *)malloc(size_in_bytes);
if (data == NULL) {
fprintf(stderr, "oppsies!\n");
return 1;
}
char userInput[256];
do {
printf("This is a virus, if you want your computer back, give me your money. [y/n]: ");
fgets(userInput, sizeof(userInput), stdin);
userInput[strcspn(userInput, "\n")] = '\0'; // configure the input
} while (strcmp(userInput, "y") != 0 && strcmp(userInput, "n") != 0);
if (strcmp(userInput, "y") == 0) {
free(data);
printf("Your computer is free! It was never in true danger, anyways.\n");
} else {
free(data);
printf("your free to go :3\n");
}
return 0;
}
Comments