当前位置: 首页 > wzjs >正文

音乐培训如何做网站宣传营销策划公司介绍

音乐培训如何做网站宣传,营销策划公司介绍,建设网站的报价,潍坊网站建设评价练习题&#xff1a; 这个题的思路是从前往后&#xff0c;从后往前同时找&#xff0c;不是字母的话就继续&#xff0c;是的话就交换。 代码&#xff1a; #define _CRT_SECURE_NO_WARNINGS 1 #include <iostream> #include <string> using namespace std; //1、4个…

练习题:

这个题的思路是从前往后,从后往前同时找,不是字母的话就继续,是的话就交换。

代码:

#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
using namespace std;

//1、4个默认成员函数
void test_string1()
{
    string s1;
    string s2("hello");
    string s3("hello", 2);
    string s4(s2);
    string s5(s2, 1, 2);
    string s6(s2, 1);
    string s7(10, 'a');
    s1 = s7;

    cout << s1 << endl;
    cout << s2 << endl;
    cout << s3 << endl;
    cout << s4 << endl;
    cout << s5 << endl;
    cout << s6 << endl;
    cout << s7 << endl;
}

//遍历
void test_string2()
{

    string s1("hello");
    s1 += ' ';
    s1 += "world";
    cout << s1 << endl;

    //读  推荐用这种方式
    for (size_t i = 0; i < s1.size(); i++)
    {
        cout << s1[i] << " ";
    }

    //写
    for (size_t i = 0; i < s1.size(); i++)
    {
        s1[i] += 1;
    }
    cout << endl;

    //读
    for (size_t i = 0; i < s1.size(); i++)
    {
        cout << s1[i] << " ";
    }
    cout << endl;

    //迭代器
    //写
    string::iterator it = s1.begin();
    while (it != s1.end())
    {
        *it -= 1;
        ++it;
    }

    //读
    it = s1.begin();
    while (it != s1.end())
    {
        cout << *it << " ";
        ++it;
    }
    cout << endl;

    //范围for
    //C++11 -> 原理是被替换成迭代器
    for (auto ch : s1)
    {
        cout << ch << " ";
    }
    cout << endl;
}

int string2int(const string& str)
{
    int val = 0;
    string::const_iterator it = str.begin();
    while (it != str.end())
    {
        //*it = 'a';//const 迭代器不能修改
        val *= 10;
        val += *it-'0';
        ++it;
    }
    return val;
}

void test_string3()
{
    string s1("hello world!");
    //倒着往前遍历
    string::reverse_iterator rit = s1.rbegin();
    //读
    while (rit != s1.rend())
    {
        cout << *rit << " ";
        ++rit;
    }
    cout << endl;

    string nums("12345");
    cout << string2int(nums) << endl;

    //方向:正向和反向
    //属性:普通和const
}

void test_string4()
{
    string s1("hello world!");
    string s2("hello");
    cout << s1.size() << endl;
    cout << s2.size() << endl;
    cout << s1.length() << endl;
    cout << s2.length() << endl;

    cout << s1.capacity() << endl;
    cout << s2.capacity() << endl;

    s1 += "hehe";
    cout << s1.capacity() << endl;
    s1.clear();//只是清除了内容,并不将capacity置0
    cout << s1 << endl;
    cout << s1.capacity() << endl;
}

void test_string5()
{
    string s;
    //s.reserve(100);
    //s.resize(100, 'x');
    size_t sz = s.size();

    cout << "making s grow:\n";
    for (int i = 0; i < 100; i++)
    {
        s.push_back('c');
        if (sz != s.capacity())
        {
            sz = s.capacity();
            cout << "capacity changed:" << sz << endl;
        }
    }
}

void test_string6()
{
    //string s;
    //s.push_back('x');
    //s.append("x");

    //s += '1';
    //s += "hello";

    //cout << s << endl;

    string s;
    s += '1';
    s += "3456";
    cout << s << endl;
    s.insert(s.begin(), '0');
    cout << s << endl;
    s.insert(2, "2");
    cout << s << endl;
    s.erase(2, 3);
    cout << s << endl;
    s.erase(2, 10);
    cout << s << endl;
}


int main()
{
    //test_string1();
    //test_string2();
    //test_string3();
    //test_string4();

    //test_string5();
    test_string6();
    return 0;
}

http://www.dtcms.com/wzjs/436924.html

相关文章:

  • 网站制作内容app推广实名认证接单平台
  • 网站建设与网页设计专业专业培训机构
  • 自建网站怎么做后台管理系统专业网络推广公司排名
  • 网站的下拉列表怎么做百度快速排名培训
  • 贵阳个人做网站网站seo站长工具
  • 仪征建设银行官方网站互联网广告代理可靠吗
  • 上海 培训网站建设太原百度快照优化排名
  • 站酷设计网站官各引擎收录查询
  • 长页网站镇江百度推广
  • 网页设计制作思路信息流优化师没经验可以做吗
  • 阜新公司做网站在线搜索引擎
  • 自己做的视频网站视频加载慢steam交易链接在哪
  • 网站建设 知识产权宣传推广方式有哪些
  • 婚纱摄影网站管理系统软文广告案例分析
  • 网络游戏排行榜2022前十名上海aso苹果关键词优化
  • 网站代码语法seo搜狗
  • 网站怎么做好优化1000个关键词
  • 烟台做网站电话张雪峰谈广告学专业
  • 马鞍山市网站建设公司最新军事报道
  • 音乐自助建站整站seo排名要多少钱
  • 岳阳市网站建设活动营销方案
  • 淄博网站优化推广企业网站建设方案书
  • 做nba直播网站有哪些人关键词排名批量查询软件
  • 网站建设模版文档一个公司可以做几个百度推广
  • 在中国怎么做国外网站企业建设网站公司
  • 做网站公司职员工资seo常用工具有哪些
  • 网站排名推广怎么做电商运营工资一般多少钱一个月
  • 嘉兴外贸网站建合肥品牌seo
  • 黄金网站app免费视频大全重庆seo和网络推广
  • 怎样在我的世界做汽车视频网站网络营销的主要手段和策略