Welcome to the first CS 141 Lab!
This first lab will get you started on code similar to what you need for the first programming assignment. You must work with a partner during each lab, and will switch partners every couple of weeks. Find a partner and introduce yourself. You will need to supply your partner's name as part of your quiz, so be sure you know how to spell it.
Quiz:
We will start each lab with a brief quiz which you will do individually. The quiz will normally be done during the first few minutes of lab.
Your lab TA will tell you the password you will need to get into the quiz for your section. Click on your lab section to access your quiz:
You may use either one of the lab machines or your own laptop. For the lab computers your account name and password are the same as your UIC netid and password.
After you have finished your quiz, if you have not already done so, use this google form to enter your information and acknowledge that you have read the Academic Honesty policy on the course web site, and that you agree to abide by it.
What you will Need to Do:
This Lab activity will help you prepare for program 1.
Hint: Consider that we could use the following statement
cout << "some text" << endl;
to print out the text:
some text
and we could use the following variable declaration and while loop to give the output 1 2 3 4 5:
int i=1; while( i<=5) { cout << i << " "; i++; }
(1) Given input of a number, display a line of dashes of that length, separated by spaces. (1 point)
Hint: I suggest you use a while loop or a for loop.
Enter a number: 4 Result is:----
(2) Given input of a number, display that number of spaces followed by an asterisk. (1 point)
Hint: Use the setw() command to set the field width. Alternatively you could again use a loop.
Enter a number: 3 Result is: *
(3 Extra Credit) Given input of a number, display an ASCII character box of that size, filled with the '.' character. (1 point for Extra Credit)
Hint: Use the setfill() command to set the character used to fill in the output field. Alternatively you could again use a loop.
Enter a number: 3 Result is: ------ |......| |......| |......| ------
Instructions:
You and your partner must choose one computer that you will use for your lab activity. For the other one log out and put it away if it is a laptop. You will take turns typing (the "driver") and watching/suggesting (the "navigator"). You will switch roles every 10 minutes, prompted by your TA (or set your own timer). This is called "pair programming" and is considered a standard industry best-practice for getting optimal results.
Log in to your Zybooks account. If you haven't already signed up in Zybooks, see the course syllabus on how to do this.
Open the first lab, found in section 1.23. Edit and run your program in "Develop Mode", and then switch to "Submit Mode" when you want to run the official tests.