Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit cd9c92fd authored by Rachel D Frenkel's avatar Rachel D Frenkel
Browse files

week 4 hw

parent 5064f218
No preview for this file type
File added
1.
brew install etags
When you changes root directories you need to update it. So if you do it in the ~ directory you shouldn't need to change it.
find . -type f -iname "*.[cppc]" | xargs etags -a //this installs what we need for etags
ctags -R *
M-. <RET>
C-u M-.
every new function, class, etc.
cscope -R
You need to rerun it when you add a new file.
vim file.name
CTRL-\ s
CTRL-D //to exit
ctags allows you to jump from function calls to the definitions as well as completion.
cscope allows to both jump from function calls to definitions and jumps to functions calls. Jumps to the file that the function is found.
ctags is fast and easy to set up while cscope is great for bigger and file types that aren't known.
They are both good in their own right.
2.
multiple cursors
(command mode) C^n until all highlighted then insert mode
Surround
(command mode) ysiw(some sort of surround here"
3.
Preferences -> Settings -> remove vintage mode
File added
#include <iostream>
using namespace std;
void sebs(){
cout << "boo I'm a ghost" << endl;
}
int main() {
sebs();
return 0;
}
// Kat
#include <iostream>
using namespace std;
int main()
{
char mlevel; // this is a valid char
bool chalmers;
string name;
double r, g, c, peoplewhoareadults;
cout << "Hi" << endl;
cin >> name >> endl;
cin >> r >> endl;
cin >> g >> endl;
cin >> c >> endl;
cin >> peoplewhoareadults >> endl;
cin >> chalmers >> endl;
cout << "What is your motivation?\n"
<< " a. Amazingly Motivated\n"
<< " b. Basicly a good worker\n"
<< " c. Can't get good help no more\n"
<< " d. Don't plan on work from me\n"
<< " e. Elevated Slothfullness \n\n"
<< "Enter the letter of your choice: ";
cin >> mlevel;
if(mlevel=='a') // this is an if statement
{
if(r>=0.5)
{
if(g<=5) // checks if g <= 5
{
cout << "burn books" << endl;
}
else
{
cout << "clean the bathroom" << endl;
}
}
else
{
if(g<=5)
{
cout << "Go get more g" << endl;
}
else if(g>=5 && g<10)
{
cout << "Mow grass" << endl;
}
else
cout << "Do laps in the tractor" << endl;
}
// This is a comment right in the middle that says I stayed up too late and didn't do my homework
// and now my code looks horrible. Large paragraphs of comments makes your code harder to read
// try using short statements to briefly explain what a block of code is actually doing instead
// of paragraphs that state nothing really important.
}
else if(mlevel=='b')
{
if(chalmers==1||peoplewhoareadults>c)
{
cout << "Scrub floors on hands and knees" << endl;
}
else
{
cout << "Mop the floor." << endl;
}
}
else if(mlevel=='c')
{
if(r<=1.5)
{
cout << "Lean on rake." << endl;
}
else
cout << "Lean on broom inside" << end;
}
else if(mlevel=='e')
{
cout << "Stay in bed" << endl;
}
return 0;
}
\ No newline at end of file
# EECS 201 HW 4
uniqname: rfrenkel
## Question 1a
``` 1a
gg=SHIFTg
```
## Question 1b
``` 1b
delete the if block then use C^v SHIFT-I then delete
```
## Question 2
``` 2
:vsplit (address of other file) C^ww to switch windows
```
## Question 3
``` 3
vim -q fileWithErrors
:C^n for next
:C^p for last
:C^c # for the numbered error
:C^open for the easy quick view
```
## Question 4
``` 4
C^v SHIFT I # then esc
```
## Question 5
``` 5
q(register)
q(stop recording)
@@ (to replay the macro)
```
## Question 6a
``` 6a
ci( <-- or whatever you are looking for
```
## Question 6b
``` 6b
:r ! ls (PATH)
```
## Question 7
``` 7
(gedit:6711): Gtk-WARNING **: 14:38:44.787: cannot open display:
it doesn't work because it is looking for a GNOME env and finds nothing
```
## Question 8
``` 8
nohup redshift &
```
## Question 9
``` 9
gedit() { /usr/bin/gedit $@ & disown ;}
```
//Programmer: Josh Wilkerson Date: 2011/09/18
//File: workDecider.cpp Class: CS53
//Purpose: This program helps groundskeeper Willie select
// the appropriate amount of work to do, given a
// level of motivation
#include<iostream>
using namespace std;
const float LEV_A_RAIN_THRESH = 0.5;
const int LEV_A_LOW_GAS = 5;
const int LEV_A_HIGH_GAS = 10;
const float LEV_C_RAIN_THRESH = 1.5;
const float LEV_D_RAIN_THRESH = 0.0;
int main()
{
char motivLev = 0, chalmersPresent = 0;
string userName = "";
float rainLev = 0;
int gasLev = 0, numChildren = 0, numAdults = 0;
//welcome and prompt the user for their name
cout << "\nWelcome to the Work-Avoider 2000\n"
<< "--------------------------------\n"
<< "Please enter your name: ";
cin >> userName;
//put the riff-raff in their place
//(NOTE: this is not part of the assignment, per se; but is obviously
//a necesary addition)
if(userName == "ClaytonPrice" || userName == "TommySzalapski")
{
cout << "\nOh come on, we both know you aren't going to do work regardless "
<< "of what I say.\n"
<< "Fine, we'll go through the motions anyway" << endl;
}
//prompt for the motivation level
cout << "\nHow motivated are you today, " << userName << "?\n"
<< " a) Amazingly motivated\n"
<< " b) Basically a good worker\n"
<< " c) Can't get good help no more\n"
<< " d) Don't plan on work from me\n"
<< " e) Elevated slothfullness\n\n"
<< "Enter the letter corresponding to your motivation level: ";
cin >> motivLev;
//determine what response to give, allowing the user to use upper or lower
//case for their motivation level
/////////////
//motivation level A
/////////////
if(motivLev == 'a' || motivLev == 'A')
{
cout << "\nWell are't we a hard worker, very impressive.\n"
<< "Tell me, " << userName << ", how many inches did it rain last "
<< "night?\n";
cin >> rainLev;
cout << "Ok, and how many gallons of gas do you have on hand (to the "
<< "nearest gallon, please)?\n";
cin >> gasLev;
//if it rained more than the rain threshold for this level
cout << endl << userName << ", you should ";
if(rainLev >= LEV_A_RAIN_THRESH)
{
cout << (gasLev <= LEV_A_LOW_GAS ?
"burn some of those ridiculous text books from the 1940's"
:
"go purify that bathroom with righteous flames of cleansing") << endl;
}
//if it rained less than the rain threshold for this level
else
{
//if we don't have much gas
if(gasLev < LEV_A_LOW_GAS)
cout << "go get more gas, then ask me what to do again" << endl;
//we have a moderate amount of gas
else if(gasLev >= LEV_A_LOW_GAS && gasLev < LEV_A_HIGH_GAS)
cout << "rev up the mower and take care of that overgrown yard" << endl;
//we have a lot of gas
else
{
cout << "fill up the biggest tractor you have and do some laps where\n"
<< "everyone can admire your impressive work ethic" << endl;
}
}
}
/////////////
//motivation level B
/////////////
else if(motivLev == 'b' || motivLev == 'B')
{
cout << "\nOk, pretty mortivated then.\n"
<< "In that case, is Superintendent Chalmers where he can see you?\n"
<< "(y or n, please): ";
cin >> chalmersPresent;
//if chalmers is present then we clean the floor on hands and knees
if(chalmersPresent == 'y' || chalmersPresent == 'Y')
{
cout << endl << userName << ", you should get on your hands and knees and"
<< " scrub that floor, an impressed boss is\n"
<< "a happy boss!" << endl;
}
//otherwise we see how many adults and children are present
else
{
cout << "Ok, the boss isn't watching. How many adults are around, then?\n";
cin >> numAdults;
cout << "And how many children are around?\n";
cin >> numChildren;
//if there are more adults than children, clean on hands and knees, mop
//otherwise
cout << endl << userName << ", you should ";
cout << (numAdults >= numChildren ?
"get some word of mouth spreading, scrub the floor on hands and knees"
:
"just mop the floor")
<< endl;
}
}
/////////////
//motivation level C
/////////////
else if(motivLev == 'c' || motivLev == 'C')
{
cout << "\nOk, so you just want to look busy; fair enough.\n"
<< "How many inches did it rain last night?\n";
cin >> rainLev;
cout << endl << userName << ", you should ";
//if it rained less than this level's rain threshold lean on a rake,
//otherwise lean on a broom inside
cout << (rainLev <= LEV_C_RAIN_THRESH ?
"go get your rake and lean on it"
:
"go inside and lean on your broom")
<< ", looking as annoyed as possible\n"
<< "(makes you look busier)" << endl;
}
/////////////
//motivation level D
/////////////
else if(motivLev == 'd' || motivLev == 'D')
{
cout << "\nOk, motivated enough to go to work, but not motivated enough to"
<< " deal with anyone.\n"
<< "How many inches did it rain last night?\n";
cin >> rainLev;
cout << endl << userName << ", you should go hide in ";
//if it rained less than this level's rain threshold hide in a hedge,
//otherwise hide in the toolshed
cout << (rainLev <= LEV_D_RAIN_THRESH ?
"a hedge"
:
"the toolshed")
<< endl;
}
/////////////
//motivation level E
/////////////
else if(motivLev == 'e' || motivLev == 'E')
{
//NOTE: this output uses escape sequences (the \"'s), if you haven't learned about
//these by the time you read this, you will soon
cout << "\n\"I don't always stay in bed and skip work, but when I do it's because\n"
<< "a computer program told me to\"\n"
<< " --The most unmotivated man in the world\n\n"
<< "Enjoy your \"sick day\", " << userName << endl;
}
/////////////
//unknown motivation level
/////////////
else
{
cout << "ERROR 87328047:\n"
<< "UNRECOGNIZED MOTIVATION LEVEL\n"
<< "TERMINATING" << endl;
}
cout << "\n--------------------------------\n"
<< "Thank you for using the Work-Avoider 2000\n" << endl;
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment