c_cpp 30天代码HackerRank

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp 30天代码HackerRank相关的知识,希望对你有一定的参考价值。

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
    int i = 4;
    double d = 4.0;
    string s = "HackerRank ";
    // Declare second integer, double, and String variables.
    int i2 = 0;
    double d2 = 0.0;
    string s2 = "";
    // Read and save an integer, double, and String to your variables.
    cin >> i2;
    cin >> d2;
    getline(cin >> ws, s2);
    // Note: If you have trouble reading the entire string, please go back and review the Tutorial closely.
    // Print the sum of both integer variables on a new line.
    cout << i + i2 << endl;
    // Print the sum of the double variables on a new line.
    cout << fixed << setprecision(1) << d + d2 << endl;
    // Concatenate and print the String variables on a new line
    cout << s + s2 << endl;
    // The 's' variable above should be printed first.
    return 0;
}

以上是关于c_cpp 30天代码HackerRank的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp 获取节点值 - Hackerrank

c_cpp [HackerRank]预订Hackathon 2015

c_cpp 从已排序的链表中删除重复值节点 - Hackerrank

c_cpp Hackerrank的“乐高积木”问题的动态编程/递归解决方案。

c_cpp 总数没有。 A和B之间的2的补码表示中的1,包括在内。 Hackerrank的“2补”问题。

c_cpp https://www.hackerrank.com/contests/worldcodesprint/challenges/two-pluses/copy-from/1301129656