STD are not created by people ! They are created by bacteria, viruses, protozoa, etc.
You can't create a sexual transmitted disease between you and you're partner. One of 2 people would have to be infected with the disease to transmit it.
Of course.
#include <iostream> #include <string> std::string* concat_print_strings(std::string* pStr1, std::string* pStr2 ) { std::string * strResult = new std::string( *pStr1 ); strResult->append( *pStr2 ); std::cout << strResult->c_str() << std::endl; return( strResult ); } int main() { std::string str1 = "This is a string."; std::string str2 = " And this is another string."; std::string* pStr = concat_print_strings( &str1, &str2 ); delete( pStr ); pStr = NULL; return( 0 ); }
#include<iostream> int main() { int num1, num2; std::cout << "C++ addition program" << std::endl; std::cout << "Enter a number: "; std::cin >> num1; std::cout << "Enter another number: "; std::cin >> num2; std::cout << "The sum is " << num1 + num2 << std::endl; }
Use a std::vector<std::string>> to store the strings, then call the std::vector::sort() method.
Example#include // for std::cout#include // for std::locale (required by C++ tolower)#include // for std::string#include // for std::sortbool SortPredicate( const char& c1, const char& c2){std::locale loc;return( tolower(c1,loc) < tolower(c2,loc) );}void Sort( std::string& s ){std::sort( s.begin(), s.end(), SortPredicate);}int main(){std::string str( "Hello" );std::cout
#include<iostream> int main (void) { int a, b; std::cout << "Enter two whole numbers:"; std::cin >> a >> b; std::cout << "The largest of " << a << " and " << b << " is << (a>b?a:b) << std::endl; }
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.
#include<iostream> int main() { double a, b; std::cout << "Enter a number: "; std::cin >> a; std::cout << "Enter another number: "; std::cin >> b; std::cout << "Sum: " << a + b << std::endl; std::cout << "Average: " << (a + b) / 2 << std::endl; }
Create a class to represent a student: struct student { string fname; string lname; unsigned age; unsigned id; }; Overload operator< to compare two student objects: bool operator< (const student& a, const student& b) { return a.lname<b.lname; } Overload std::ostream::operator<< to print a student: std::ostream& operator<< (std::ostream& os, const student& s) { return os << s.fname << ' ' << s.lname << ' ' << s.age << ' ' << s.id; } Now you can write your program: int main() { std::vector<student> v; for (unsigned count=0; count<100;) { student s; std::cout << "Enter details for student #" << ++count; std::cout << "First name: "; std::cin >> s.fname; std::cout << "Last name: "; std::cin >> s.lname; std::cout << "Age: "; std::cin >> s.age; std::cout << "ID: "; std::cin >> s.id; v.push_back (s); } std::cout << "Sorting..." std::sort (v.begin(), v.end()); std::cout << "\n\n"; // Print students... for (auto s : v) std::cout << s << std::endl; }
That is an STD
#include<iostream> #include<queue> #include<stack> int main() { int x = 0x1f; int y = 0xa2; std::cout.hex; std::cout << "0x" << std::hex << x << " + " << "0x" << std::hex << y << " = " << "0x" << std::hex << x+y << std::endl; }
They aren't different, they are quite literall the same thing people choose to use sti or std THERE IS NO DIFFERENCE