Both. for (int x=0; x<10; ++x) { // outer loop for (int y=0; y<10; ++y) { // nested loop std::cout << x*y << '\t'; } // end nested loop std::cout << std::endl; } // end outer loop std::cout << std::endl; void f(bool x, bool y) { if (x==y) { if (x) { std::cout << "x and y are both true\n"; } else { std::cout << "x and y are both false\n"; } } else { if (x) { std::cout << "Only x is true\n" } else { std::cout << "Only y is true\n" } } } Note that the nested if within the else clause of the outer if can also be written as an else if statement: void f(bool x, bool y) { if (x==y) { if (x) { std::cout << "x and y are both true\n"; } else { std::cout << "x and y are both false\n"; } } else if (x) { std::cout << "Only x is true\n" } else { std::cout << "Only y is true\n" } }
#include<iostream> int main() { std::cout << "sin(1) = " << std::sin(1.0) << std::endl; std::cout << "cos(1) = " << std::cos(1.0) << std::endl; std::cout << "tan(1) = " << std::tan(1.0) << std::endl; std::cout << "asin(1) = " << std::asin(1.0) << std::endl; std::cout << "acos(1) = " << std::acos(1.0) << std::endl; std::cout << "atan(1) = " << std::atan(1.0) << std::endl; } Output: sin(1) = 0.841471 cos(1) = 0.540302 tan(1) = 1.55741 asin(1) = 1.5708 acos(1) = 0 atan(1) = 0.785398
#include<iostream> #include<vector> #include<string> std::vector<std::string> parse (const std::string& s, const char delim) { std::vector<std::string> result {}; auto start = 0U; auto end = s.find (delim); while (end != s.npos) { result.push_back (s.substr(start, end - start)); start = ++end; end = s.find (delim, start); } result.push_back (s.substr (start, s.npos - start)); return result; } std::vector<std::string> parse (const std::string& s, const std::string& delim) { std::vector<std::string> result {}; auto start = 0U; auto end = s.find (delim); while (end != s.npos) { result.push_back (s.substr(start, end - start)); start = end + delim.length(); end = s.find (delim, start); } result.push_back (s.substr (start, s.npos - start)); return result; } int main() { std::string str1 = "This is a string that will be parsed by a single-space delimiter."; std::string str2 = "This==is==a==string==that==will==be==parsed==by==equal==operator."; std::string str3 = "This string has no delimiter."; std::cout << str1 << std::endl; std::vector<std::string> v1 = parse (str1, ' '); for (auto i : v1 ) std::cout << i << std::endl; std::cout << std::endl; std::cout << str2 << std::endl; std::vector<std::string> v2 = parse (str2, "=="); for (auto i : v2 ) std::cout << i << std::endl; std::cout << std::endl; std::cout << str3 << std::endl; std::vector<std::string> v3 = parse (str3, '\\'); for (auto i : v3 ) std::cout << i << std::endl; std::cout << std::endl; }
int main() { std::string first, last; std::cout << "Enter your first name: "; std::cin >> first; std::cout << "Enter your last name: "; std::cin >> last; }
Assuming the quiz is a simple question/answer style quiz, use a map to associate question strings with answer strings. In order to prevent people from simply examining the program resources to get the answers, you should also consider encrypting the map. For multiple choice quizzes, use a structure containing the question string, a vector of strings for the possible answers and an unsigned integer to identify the correct answer (as an index into the vector).
you can get an std
maybe the people are poor and looking for water and dirty water is the only water they can get.
If it's dirty, then just wash it with soap, but if you had an STD, you need to go to the clinic
India is not a dirty place. only people liter and when every one liters it makes it dirty. its just like United States of America
TONGUE HERPES only 25% of people get this rare type of STD.
Of course.
No, all of them can.
Sometimes but only by accident (unless they're really fighting dirty!)
Trichomoniasis is the most common protozoan STD in the US. Aside from giardia, which is rarely sexually transmitted, it's the only protozoan STD.
Being dirty has nothing to do with sexual orientation. But if you look at the numbers, there are more dirty straight people on this planet than gay people.
STD are common in people who are sexually active... if you are sexually active at the age of 20 then you are high risk to have an STD.
some peaple have dirty minds only if there crazy