CS1010E Programming Methodology
POH YEE HUI Electrical Engineering Year 3
MinGW Unix Shell Emulator Commands: –cd:Change Directory (folder) –ls:LiSt files –mkdir:MaKe DIRectory (folder) –rmdir:ReMove DIRectory (folder) –cp:CoPy (copy and paste) –mv:MoVe (cut and paste + rename) –rm: ReMove (delete)
Vim Text Editor Commands –vim program.c (in MinGW):Open program.c file using Vim –i:Insert mode –v:Visual mode (for selection/highlight) –Esc:Command mode –y:Yank (copy) –x:Cut –p:Paste
Skeleton Template #include “stdio.h” int main() { // your code return 0; }
Output (printf) printf(“%d \n”, variable); New lineVariable Name Format Specifier %d : integer %lf : double (long float) %c : character %s : string
Input (scanf) scanf(“%d”, & variable); Variable NameFormat Specifier %d : integer %lf : double (long float) %c : character %s : string
Operations (+ - * /) circumference = 2 * * radius;
Task 1: Distance 1 km = miles Convert km to miles Display distance in miles (output) Get distance in km (input)
Task 2: Sum Get the sum of the integers Display the sum (output) Get 2 integer (input)
Good Luck!! Have Fun!! Poh Yee Hui