题目说明:
示例代码:
// day01_dataType.cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <windows.h>
#include <iomanip>
#include <sstream>
#include <iostream>
using namespace std;
int main()
{
int i = 4;
double d = 4.0;
string s = "HackerRank";
//Declare second integer, double, and String variables.
int i1 = 0;
double d1 = 0.0;
string s1 = "";
//Read and save an integer, double, and String to your variables.
cin >> i1;
cin >> d1;
cin.ignore();//also use getchar()
getline( cin, s1 );
//print
cout << i + i1 << endl;
cout << fixed << setprecision( 1 ) << d + d1 << endl;
cout << s + s1 << endl;
system( "pause" );
return 0;
}
基础知识点:
1、格式化输出(cout)