# #C Programming (II) - 5 Nicolas Louis --- ### [1 One-dimensional array, character array](https://hackmd.io/@voxana/BJF6VJVhH) ### [2 Two-dimensional array, sort search algorithm](https://hackmd.io/@voxana/H1afCC73B) ### [3 Function](https://hackmd.io/@voxana/SJLPsKdnH) ### [4 Recursive, random](https://hackmd.io/@voxana/BJycGKZTS) --- ### Supplementary description array ---- One-dimensional array of integers ```c= int score[5] ``` ![](https://i.imgur.com/6VXjQOK.png) ---- Two-dimensional array of integers ```c int score[4][3] ``` ![](https://i.imgur.com/yIWvupw.png) ---- ![](https://i.imgur.com/PDnjO9Z.png) ---- ![](https://i.imgur.com/Ev4Jd0S.png) ---- #### Character array-string ```c char name[5] = "FCU"; ``` ![](https://i.imgur.com/gAivNwg.png) --- #### Exercise Large number addition Adds two strings using a character array String length up to 100 ``` Example input: 9999999999999999 + 1 333333333333333333 + 987654321 134679134679 + 123456789987654321 ``` ``` Example output: 10000000000000000 333333334320987654 123456924666789000 ``` --- ### windows.h Change color, set cursor position, delay ```c #include<stdio.h> #include<stdlib.h> #include<windows.h> #include<time.h> void setcolor(int x) { SetConsoleTextAttribute ( GetStdHandle ( STD_OUTPUT_HANDLE ),x); return; } void gotoxy(int xpos, int ypos) { COORD scrn; HANDLE hOuput = GetStdHandle(STD_OUTPUT_HANDLE); scrn.X = xpos; scrn.Y = ypos; SetConsoleCursorPosition(hOuput,scrn); } int main() { //system("MODE CON COLS=50 LINES=20"); int i; getchar(); CONSOLE_CURSOR_INFO cursor_info = {100, 0}; //0 means hidden SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info); // for(i = 0; i < 256; i++){ // setcolor(i); // gotoxy(i, i); // printf("%d\n", i); // Sleep(100); // } return 0; } ``` --- Can continue to do oj ~ https://onlinejudge.org/ ---
{"metaMigratedAt":"2023-06-15T02:21:30.787Z","metaMigratedFrom":"YAML","title":"W5 - General review","breaks":true,"slideOptions":"{\"transition\":\"slide\"}","contributors":"[{\"id\":\"befaa4d9-75b6-4c05-baa7-7949e0ffa1e2\",\"add\":1976,\"del\":0}]"}
    241 views