VG101 RECITATION 1 By TAs
CONTENTS Intro to SAKAI Intro to APG Intro to Online Quiz System Installation of VS2005 and possible resources Some common mistakes Q&A
INTRO TO SAKAI user name (EID) and password (by default, it is your student ID) Important folders: Announcements, Resources, Assignments Check SAKAI at least once a day
INTRO TO APG user name (EID) and password (by default, it is , so change you password ASAP) Using Tags write console.printLine(“ ”, answer, “ ”); instead of console.printLine(answer);
INTRO TO APG 1. Use EID and password to login 2. Select an assignment. 3. Click its title to go to assignment description. 4. Paste code there and submit.
INSTALLATION OF VS2005 Make sure that you have a right version click Help -> about Microsoft Visual Studio Use the CS106B/X template to create a new project click File -> New -> Project For detailed steps, look up your lab meterials
SOME COMMON MISTAKES include Vg101class.h include int main (void) { double x, y, z x = console.readDouble("Please enter a number: "); y = console.readDouble(“/nPlease enter a second number: "); z = x^2; z =+ y * y; console.printLine(“/nThe answer is ", sqrt(z)); { How many bugs can you find? 1~10
SOME COMMON MISTAKES #include "Vg101class.h" #include int main (void) { double x, y, z; ConsoleT console; x = console.readDouble("Please enter a number: "); y = console.readDouble("\nPlease enter a second number: "); z = x * x; z += y * y; console.printLine("\nThe answer is ", sqrt(z)); return 0; } Missing # Missing ; Missing declaration Missing “” /n should be \n x^2 should be x * x =+ should be += Missing return 0; { should be } 9 bugs !!
SOME COMMON MISTAKES 5 % 2 = ? 5 / 2 = ? -5 % 2 = ? -5 / 2 =? -5 % -2 = ? -5 / -2 = ? Write your own program to find them Remember: (x/y) * y + (x%y) = x The answers are: 1, 2, -1, -2, -1, 2