beep, boop

This commit is contained in:
left_adjoint 2024-01-22 08:54:51 -08:00
parent f79359da32
commit f83237f21b
2 changed files with 52 additions and 0 deletions

13
L3agenda.org Normal file
View File

@ -0,0 +1,13 @@
* Lecture 3 agenda (January 22nd 2024)
+ Venting about being iced in!
+ Formatting (a.k.a let's make a table!!!)
+ setw
+ left
+ right
+ setfill
+ setprecision
+ fixed
+ Review of while-loops
+ Review of if-statements
+ A taste of for-loops (and what they're good for)
+ Time to work

39
firstSetw.cpp Normal file
View File

@ -0,0 +1,39 @@
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
cout << "This is how " << 10 << " things normally appear" << endl;
cout << "(Now with default alignment and a width of 20)" << endl;
cout << setw(20) << "This is how " << setw(20) << 10 << setw(20) << " things normally appear" << endl;
cout << "Why doesn't the last bit look right aligned?" << endl;
cout << "Now for messing with alignment" << endl;
cout << left << setw(20) << "This is how " << right << setw(20) << 10 << setfill('*') << left << setw(40) << " things normally appear" << endl;
cout << endl << endl;
cout << "Now let's build a table" << endl;
//we build the top of the table
cout << setfill('-');
cout << right;
cout << "|" << setw(21);
cout << "|" << setw(21);
cout << "|" << setw(21) << "|" << endl;
cout << setfill(' ');
cout << left;
cout << "|" << setw(20) << "Ink name";
cout << "|" << setw(20) << "Color";
cout << "|" << setw(20) << "Brand name" << "|" << endl;
// we can build the rest of the table
return 0;
}