View my playlist of Commodore 64 games videos. They are all several minutes in length, and show enough of each game to serve as a preview for those who are looking for retro games to try.
https://github.com/pereiradaniel/beginning_c/blob/master/ch2/exercises/2_4/exercise2_4.c // Exercise 2-4 // Write a program that prompts for the user’s weekly pay in dollars and the // hours worked to be entered through the keyboard as floating-point values. The program // should then calculate and output the average pay per hour in the following form: // Your average hourly pay rate is 7 dollars and 54 cents. #include <stdio.h> double checkInput(double input, double min, double max); int main(int argc, char* argv[]) { double hours = 0, rate = 0; // Get input for hours: printf("Enter number of hours worked: "); while(hours == 0) { scanf(" %lf", &hours); hours = checkInput(hours, 1, 10000); } // Get input for salary: printf("Enter hourly rate: "); while(rate == 0) { scanf(" %lf", &rate); rate = checkInput(rate, 1, 100); } // Calculate pay:...
https://github.com/pereiradaniel/beginning_c/blob/master/ch2/init.c // init.c // Daniele Grech Pereira, 02 November 2022 // Demonstration of variables before and after initialization. #include <stdio.h> #define LENGTH(a) sizeof(a) / sizeof(a[0]) void display(char* string, int array[], int size); int main(int argc, char* argv[]) { int num[10] = {1,2,3,4,5,6,7,8,9,10}; // Simultaneously declare and initialize a variable. int num2[10]= {1,2,3}; // First three are specified, the rest set to 0. int num3[10]= {0}; // Easy way to initialize all array values with 0. int arr[10]; // Declare an array of ints without initializing. // Printing the uninitialized array int arr[] will display garbage and generate warnings // from valgrind. display("Printing int num[] which has been initialized with data:", num, LENGTH(num)); display("Printing int num2[] which has been initialized with...