SlideServe
Menu
Préférences
© SlideServe · v2026

Comprehensive C Programming Workshop: Features, Functions, and File Handling

sylvie avatar
13 diapositives · 323 Views · Jul 14, 2014

Join our hands-on C programming workshop designed to enhance your understanding of data types, operations, and file management in C. Work with real-world examples to master the essential components of the C language including variables, control structures, standard libraries, and data transformations. Engage in practical exercises that challenge you to manipulate data, implement functions, and optimize program output. By the end of this workshop, you'll be equipped with the skills to write robust C programs and effectively interact with data input/output operations.

Comprehensive C Programming Workshop: Features, Functions, and File Handling - slide 1
01 / 13Comprehensive C Programming Workshop: Features, Functions, and File Handling
1 / 17

Télécharger la présentation

Comprehensive C Programming Workshop: Features, Functions, and File Handling
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. THE C PROGRAM WORKSHOP

  2. Workshop Features Bins for parts and supplies Door for unexpected results to go out Door for expected results to go out WORKSHOP A B C D Communication with other shops Door for requests to go in X Y Z Instructions and operating procedures Various tools

  3. A computer program written in C is like a workshop Current Data (Information) main Transformed Data (Information) It brings data into the program from the outside world, performs some processing with it, makes some changes to it, and then returns it to the outside world in a different form

  4. C Program Entrances and Exits Constants and variables STANDARD ERROR (stderr) main STANDARD OUT (stdout) A B C D File and Device Input/Output STANDARD IN (stdin) X Y Z Instructions and operating procedures Operations and functions

  5. Data Types • Integers (int) • Numbers with decimal points (float) • Characters (char) • Words and Phrases (ex. char phrase[10]) • Tables (ex. int values[10], float matrix[20][30]) • Records (ex. struct myRecordType)

  6. Data Storage Locations int aNumber; float aValue; char aSymbol; char phrase[LENGTH]; int values[15];

  7. Simple Operations • Storage (=) • Addition (+) • Subtraction (-) • Multiplication (*) • Division (/) • Modulo (%) • Comparison (==, !=, <, <=, >, >=)

  8. Instructions and Decisions • variableLocation = expression • Ex. count = 17 * MAX_LOOPS; • if (Boolean condition) statement else statement • Ex. if (numberIsValid) count++; else count--; • while (Boolean condition) statement • Ex. while (count > MAX_LOOPS) count = count – 5; • for (statement; condition; statement) statement • Ex. for (i = 0; i < size; i++) printf(“%d\n”, table[i]);

  9. Technical Vocabulary: C Keywords auto double int struct breakelse long switch case enum register typedef char extern return union const float short unsigned continuefor signed void default goto sizeof volatile doif static while (Note: Keywords in bold-face font are used with data types)

  10. Standard C Library Functions • Standard Input and Output: • printf, scanf, getchar, gets • Conversion of Data: • isalpha, isdigit, tolower, toupper • Math: • sin, cos, tan, sqrt, log, exp • Working with Files: • fopen, fclose, fscanf, fprintf, fgets

  11. Example Program - C Source Code int main(void){int theCheckNbr;char theAccount;char theTaxCode;float theAmount;float theBalance;theBalance = 2391.52; printf("Ck Nbr Acct Tax Amount Balance\n");printf("------ ---- --- ------ -------\n");theCheckNbr = 234;theAccount = ‘B';theTaxCode = ‘Z';theAmount = 34.56;theBalance = theBalance - theAmount;printf("%6d %2c %2c %6.2f %7.2f\n", theCheckNbr, theAccount, theTaxCode, theAmount, theBalance);return 0;} // End main

  12. Example Program Output Ck Nbr Acct Tax Amount Balance ------ ---- --- ------ ------- 234 A Z 34.56 2356.96

  13. Example Program Exercise • Using the current pattern of statements in the program, add the source code to display the last two lines of the report shown below • Also, change the order of the report columns Ck Nbr Amount Acct Balance Tax ------ ------ ---- ------- --- 234 34.56 B 2356.96 Z 235 192.73 T 2164.23 W 236 75.00 G 2089.23 X 