반응형 해커랭크10 [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] 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. [HackerRank] Classes and Objects - Easy https://www.hackerrank.com/challenges/classes-objects/problem Classes and Objects | HackerRank Familiarize yourself with classes and objects. www.hackerrank.com #include #include #include #include #include #include using namespace std; // Write your Student class here class Student{ private: int scores[5]; int sum; public: Student():sum(0) {} void input(){ for(int i=0;i>scores[i]; } } int calcul.. 2019. 10. 16. 이전 1 2 다음 반응형