#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; }
A simple array has of basic data type such as char, int, float... arrays of structure has the type of structure.struct student std[12];Here std is an arrays of structure.
#include<iostream> #include<vector> #include<string> struct employee { std::string forename; std::string surname; std::string department; }; struct directory { std::vector<employee> v; void add_employee (const std::string&, const std::string&, const std::string&); }; void directory::add_employee (const std::string& forename, const std::string& surname, const std::string& department) { v.push_back (employee{forename, surname, department}); } int main() { std::string forename, surname, department; std::cout << "Enter employee's forename: "; std::cin >> forename; std::cout << "Enter employee's surname: "; std::cin >> surname; std::cout << "Enter employee's department: "; std::cin >> department; add_employee (forename, surname, department); }
India has hundreds of STD Codes (telephone area codes). Please be more specific.
You can say "Please contact Dan" or "Please contact me." Both versions are correct – it just depends on whether you want to specify who should be contacted or leave it open for the recipient to choose.
#include<iostream> #include<vector> #include<string> #include<sstream> #include<algorithm> #include<functional> double input_number (const int i) { double value; while (true) { std::string input; std::cout << i << ". Please enter a valid number: "; std::getline (std::cin, input); std::stringstream ss {input}; if (ss >> value) break; std::cout << "Invalid number, please try again." << std::endl; } return value; } int main (void) { std::vector<double> nums {}; std::cout << "Input 100 numbers\n"; for (int i=0; i<100; ++i) nums.push_back (input_number (i)); std::sort (nums.begin(), nums.end(), std::greater<double>()); std::cout << "Numbers sorted by order of magnitude:\n"; for (auto num : nums) std::cout << num << std::endl; }
no that means you have an std please go to the doctor
Yes, "Please submit the report to Johanna or myself" is correct grammar. The use of "myself" as a reflexive pronoun in this sentence is appropriate because it refers back to the subject, "I."
There are many postal codes and STD Codes (telephone area codes) in the state of Tamil Nadu. Please be more specific.
How magnets are made from magnetite? Please give simple answer for a 6th std student. Thanks. Josh
Use myself reflexively: I hurt myself. For sententious emphasis: For myself, I prefer scotch. Never use myself as the object of a verb or a preposition ( except reflexively, as above ). The correct word in all such cases is me: If you have any problems with this, please see the director or me.
Not being bad at what? Please be more specific in your question.
I need a maison and live by myself please help call
please study tamil from 6 std to pg level
If I am aware of myself, then I must be here.