测试在csdn博客中插入代码

来源:互联网 发布:网络的利与弊议论文 编辑:程序博客网 时间:2024/06/02 19:18

测试插入代码

测试1:直接复制粘贴文本的方式

#include<iostream>
#include<string>

int main()
{
std::cout << "please enter your first name:";
std::string name;
std::cin >> name;

const std :: string greeting = "hello,"+ name + "!";

const std :: string spaces(greeting.size(),' ');

const std :: string second ="*" + spaces + "*";

const std :: string first (second.size(),'*');


std :: cout <<std ::endl;
std :: cout <<std::endl;
std :: cout <<first<<std::endl;
std :: cout <<second<<std::endl;
std :: cout <<"*"<<greeting<<"*"<<std ::endl;
std :: cout <<second<<std :: endl;
std :: cout <<first<<std::endl;


return 0;



测试2:插入代码的方式,注意选择编程语言

#include<iostream> #include<string>int main(){std::cout << "please enter your first name:";std::string name;std::cin >> name;const std :: string greeting = "hello,"+ name + "!";const std :: string spaces(greeting.size(),' ');const std :: string second ="*" + spaces + "*";const std :: string first (second.size(),'*');std ::  cout <<std ::endl;std ::  cout <<std::endl;std ::  cout <<first<<std::endl;std ::  cout <<second<<std::endl;std ::  cout <<"*"<<greeting<<"*"<<std ::endl;std ::  cout <<second<<std :: endl;std ::  cout <<first<<std::endl;return 0;   } 

测试3:引用代码片的方式

#include #includeint main(){std::cout << "please enter your first name:";std::string name;std::cin >> name;const std :: string greeting = "hello,"+ name + "!";const std :: string spaces(greeting.size(),' ');const std :: string second ="*" + spaces + "*";const std :: string first (second.size(),'*');std ::  cout <


分别使用三种方式插入代码片,具体何种方式最有效,得看博客审核通过后的实际情况了……


原创粉丝点击