A program that will output the printable characters for character code values from 0 to 127. Each character code is printed along with its symbol. Make sure the columns are aligned.
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:...
The char type in C is an integer which gets decoded as a character. You can print the char's numerical type. https://github.com/pereiradaniel/beginning_c/blob/master/ch2/char.c // Chars // Daniel Pereira, 16 November 2022. // Display a char and it's numerical value. #include <stdio.h> int main(int argv, char* argc[]) { char c = 0; printf("Enter a character: \n"); scanf(" %c", &c); printf("The character: %c\nIt's numerical value: %d\n", c, c); return 0; } https://github.com/pereiradaniel/beginning_c/blob/master/ch2/char.txt ==87== Memcheck, a memory error detector ==87== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==87== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info ==87== Command: ./char ==87== Enter a character: X The character: X It's numerical value: 88 ==87== ==87== HEAP SUMMARY: ==87== in use at exit: 0 bytes in 0 blocks ==87== total heap usage: 2 al...