首页 > 其他分享 >数组4

数组4

时间:2023-04-17 12:44:10浏览次数:32  
标签:cout s2 s1 数组 test DEF string

#include<string>
#include<iostream>
using namespace std;
inline void test(const char *title,bool value){
cout<<title<<"returns"<<(value?"true":"false")<<endl;
}
int main()
{
string s1="DEF";
cout<<"s1 is"<<s1<<endl;
string s2;
cout<<"Please enter s2:";
cin>>s2;
cout<<"length of s2:"<<s2.length()<<endl;
test("s1<=\"ABC\"",s1<="ABC");
test("\"DEF\"<=s1","DEF"<=s1);
s2+=s1;
cout<<"s2=s2+s1:"<<s2<<endl;
cout<<"length of s2:"<<s2..length()<<endl;
return 0;
}

标签:cout,s2,s1,数组,test,DEF,string
From: https://www.cnblogs.com/yuanxinglan/p/17325493.html

相关文章

  • 13 数组基本概述
    1.数组基本概述 2.数组的基本使用 ......
  • NumPy 秘籍中文第二版:二、高级索引和数组概念
    在本章中,我们将介绍以下秘籍:安装SciPy安装PIL调整图像大小比较视图和副本翻转Lena花式索引位置列表索引布尔值索引数独的步幅技巧广播数组简介NumPy以其高效的数组而闻名。之所以成名,部分原因是索引容易。我们将演示使用图像的高级索引技巧。在深入研究索引之前,我们将安装必......
  • 数组3
    #include<iostream>usingnamespacestd;intmain(){ intLine1[]={1,0,0}; intLine2[]={0,1,0}; intLine3[]={0,0,1}; int*pLine[3]={line1,line2,line3}; cout<<"Matrixtest:"<<endl; for(inti=0;i<3;i++){ for(intj=0;j<3;j++) ......
  • 数组2
    #include<iostream>usingnamespacestd;voidrowSum(inta[][4],intnRow){ for(inti=0;i<nRow;i++){ for(intj=1;j<4;j++) a[i][0]+=a[i][j]; }}intmain(){ inttable[3][4]={{1,2,3,4},{2,3,4,5},{3,4,5,6}}; for(inti=0;i<3;i++){ for(intj=0;j<......
  • 数组1
    #include<iostream>usingnamespacestd;intmain(){ inta[10],b[10]; for(inti=0;i<0;i++){ a[i]=i*2-1; b[10-i-1]=a[i]; } for(constauto&e:a) cout<<e<<""; cout<<endl; for(inti=0;i<10;i++) cout<<b[i]<&......
  • 输入五个int型和五个float型求两个max(数组和重载函数)
    利用数组和函数重载求5个数最大值(分别考虑整数、单精度的情况)。输入格式:分别输入5个int型整数、5个float型实数。输出格式:分别输出5个int型整数的最大值、5个float型实数的最大值。输入样例:在这里给出一组输入。例如:1122666445511.1122.2233.33888.8855.55......
  • 53. 最大子数组和(力扣)
    https://leetcode.cn/problems/maximum-subarray/1.暴力+前缀和classSolution{public:intmaxSubArray(vector<int>&nums){constintN=1e5+10;intsums[N];for(inti=0;i<nums.size();i++)if(i==0)sums[i]=nu......
  • C++动态数组(vector.h)
    #include<iostream>#include<vector>intmain(){std::vector<std::string>con;con.push_back("9999");std::cout<<con[0];return0;}vector搞了一个多态,你可以随便赋值和数组一样,不过是动态的,读取的话vector有自带的比for更优雅的方式......
  • vue做多选,传递数组类型到后端
    1.需求:多选框选择多个类型,把选中的数据传递到后端当初在做多选框,直接用了element-ui里面的el-check-box属性,在官网里面说,是使用v-modol绑定数值来传递,好嘛,,,传的一直是true!!不是我想要的数据,也是很久没使用vue框架了,做的时候很是怀疑自己,使用value来绑值?使用v-model?使用v-bind???一直试......
  • 【前缀和】LeetCode 523. 连续的子数组和
    题目链接523.连续的子数组和思路参考宫水三叶大佬题解一开始以为和Leetcode53MaximumSubarray思路差不多,都是求子数组的值。但是后来发现在53题中并没有求出每个子数组的和,只是在贪心的情况下求出了可能的最大和代码classSolution{publicbooleancheckSubarra......