본문 바로가기
반응형

C++14

[HackerRank]Vector-Erase-Easy https://www.hackerrank.com/challenges/vector-erase/problem Vector-Erase | HackerRank Erasing an element from a vector. www.hackerrank.com #include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n; vector v; int res; int target1,target2; cin>>n; for(int i=0;i>res; v.push_back(res); } cin>>target1;.. 2019. 10. 29.
[HackerRank]Vector-Sort - Easy https://www.hackerrank.com/challenges/vector-sort/problem Vector-Sort | HackerRank Learn about the container vector. Sort a vector and print the sorted vector. www.hackerrank.com #include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n; int res; vectorv; cin>>n; for(int i =0;i>res; v.push_back(r.. 2019. 10. 29.
[HackerRank] Virtual Functions -Medium https://www.hackerrank.com/challenges/virtual-functions/problem Virtual Functions | HackerRank Learn how to use virtual functions and solve the given problem. www.hackerrank.com class Person { public: virtual void getdata()=0; virtual void putdata() const=0; protected: int age; std::string name; }; class Professor : public Person { public: void getdata() { cin>>name>>age>>publications; cur_id=++.. 2019. 10. 28.
[HackerRank] Exceptional Server - Easy https://www.hackerrank.com/challenges/exceptional-server/problem Exceptional Server | HackerRank Handle server errors. www.hackerrank.com /* Enter your code here. */ try{ cout 2019. 10. 25.
[HackerRank] Inherited Code - Easy https://www.hackerrank.com/challenges/inherited-code/problem Inherited Code | HackerRank Handle errors that can occur in the existing code. www.hackerrank.com /* Define the exception here */ class BadLengthException { private: int nameLength; public: BadLengthException(int n) : nameLength(n) {} virtual int what() const { return nameLength; } }; 2019. 10. 25.
[HackerRank] Box it! - easy https://www.hackerrank.com/challenges/box-it/problem Box It! | HackerRank Design a class named Box with overloaded operators. www.hackerrank.com class Box{ // The class should have the following functions : private: int l; int b; int h; public: // Constructors: Box() { l=0; b=0; h=0; } Box(int length,int breadth,int height) { l=length; b=breadth; h=height; } Box(const Box &ref) { l=ref.l; b=ref... 2019. 10. 23.
반응형