110 likes | 287 Views
CS1010E Programming Methodology. POH YEE HUI. Electrical Engineering Year 3. yhpoh91@nus.edu.sg. 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)
E N D
POH YEE HUI Electrical Engineering Year 3 yhpoh91@nus.edu.sg
MinGW • Unix Shell Emulator • Commands: • cd : Change Directory (folder) • ls : LiSt files • mkdir : MaKeDIRectory (folder) • rmdir : ReMoveDIRectory (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); Format Specifier New line Variable Name %d : integer %lf : double (long float) %c : character %s : string
Input (scanf) scanf(“%d”, &variable); Format Specifier Variable Name %d : integer %lf : double (long float) %c : character %s : string
Operations (+ - * /) circumference = 2 * 3.142 * radius;
Task 1: Distance 1 km = 1.609 miles Get distance in km (input) Convert km to miles Display distance in miles (output)
Task 2: Sum Get 2 integer (input) Get the sum of the integers Display the sum (output)
Good Luck!! Have Fun!! Poh Yee Hui yhpoh91@nus.edu.sg