Methods
string line = "Bob";
cout << "Hey! " << line << endl;
movies.csvand I want to do a case-insensitive search for 'mad max'.
void printMe(int& i)
{
cout << i << endl;
}
/*********************/
printMe(1);
printMe(2);
If I want to read an entire line of text into a string called 's' (i.e., not just a single word). HINT: getline()
cout << vec.at(2) << endl;
void printMe(int& i)
{
cout << i << endl;
}
/*********************/
int i = 0;
printMe(i);
i = 5;
printMe(5);
vector<string> vec; vec.push_back("bob"); vec.push_back("shaq"); cout << vec.at(2) << endl;
void printMe(int& i)
{
cout << i << endl;
}
/*********************/
int n = 37;
++n;
printMe(n);
int x = 5;
if(x == 5 || x % 2 == 0)
{ cout << "yes" << endl;
} else { cout << "no" << endl;
}
What's the difference between accessing vectors using [] and calling .at()? e.g.,
cout << vec.at(0) << endl; cout << vec[0] << endl;
Zip,High,Low 08108,78,61 08033,77,60 19093,79,63I just want the second columns, the high's.
void changeMe(int& i)
{
i = 5;
}
/*********************/
int n = 37;
changeMe(n);
cout << n << endl;
vector<double> vec;
for(int i = 0; i < 10; ++i)
{
vec.push_back(i);
}
cout << vec.size() << endl;
double CalculateMinimumDatingAge(int age) { return age / 2 + 7; }