Politechnika Śląska - strona 284

Wybór ustawianego parametru

  • Politechnika Śląska
  • Pomiary przemieszczeń
Pobrań: 0
Wyświetleń: 469

Wybór ustawianego parametru Aby wybrać żądany parametr, należy nacisnąć przycisk Menu, co rozwinie pasek z opcjami menu operacyjnego. Aby ustawić dany parametr, należy nacisnąć odpowiadający mu przycisk menu. Przykładowo, jeżeli chce się zmieni...

Arithmetic operators

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 427

Arithmetic operators • +, -, *, /, % • Example: a year is a leap year if it is divisible by 4 but not by 100, except that years divisible by 400 are leap years. if ((year%4 == 0 && year%100 != 0) || year%400 == 0)

Assignment operators op

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 427

Assignment operators op = • If expr 1 and expr 2 are expressions, then expr 1 op= expr 2 is equivalent to expr 1 = ( expr 1 ) op ( expr 2 ) except that expr 1 is computed only once. • op may be one of: + - * / % & ^ | • Examples: ...works like: x += 10; x = x+10; a *= b + c; a = a*(b+c); ...

Buffering - examples

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 574

Buffering • The hard drive is not capable of reading/writing sinlge bytes • The smallest amount is usually 512 bytes (a sector) • What happens if your program writes single bytes? • When using buffered i/o, they are buffered - A buffer is filled without writing data to HDD - When the buffer is full...

Character Input - examples

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 448

Character Input • Reading a single character or EOF: int getc(FILE *stream); the above is called a prototype • Example: int c; c = getc(stdin); • Why to use int for c instead of char? • Reading...

Conditions - examples

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 539

Conditions - examples • if (ab) printf(”yes!\n”); • if (ab && bc) ... • if (2+a == 3*b) ... • if ((a4) == (b9 && an++) ... /* will n be incremented? */ ...

Echo - examples

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 700

Echo #include /* echo command-line argument s; 1st version (K&R) */ int main(int argc, char *argv[]) { int i; for (i = 1; i /* echo command-line arguments; 2nd version (K&R) */ int main(int argc, char *argv[]) { while (--argc 0) printf(&...

File copying

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 14
Wyświetleń: 1120

File copying #include /* copy input to output; 1st version */ int main() { int c; c = getchar(); while (c != EOF) { putchar(c); c = getchar(); } return 0; } ...

Fill the table at run time

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 546

fill the table at run time char *name[4]; /* an array of 4 pointers to characters */ name[0] = (char*) malloc(strlen("Illegal month")+1); if (name[0]==NULL) fprintf(stderr,"Out of memory\n"); else strcpy(name[0],"Invalid mo...

Increment and Decrement Operators

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 406

Increment and Decrement Operators • ++ • -- • may be used either as: - prefix operators (before the variable, as in ++i ) - postfix operators (after the variable: i ++ ) • Example: if i is 3, then k = i++; sets k to 3, but k = ++i; sets k to 4; bo...