随笔分类 -  C/C++

摘要:string string toupper(),将string字符串中的字符转为大写字符 string s="SADfdfsf"; s[i]=toupper(s[i]); tolower(),将string字符串中的字符转为小写字符 string s="SADfdfsf"; s[i]=toupper 阅读全文
posted @ 2023-04-21 23:06 fun-debug 阅读(7) 评论(0) 推荐(0) 编辑
摘要:C语言函数 floor函数 向下取整 floor(x) 返回的是x的整数部分。如: floor(2.5) = 2 floor(-2.5) = -3 ceil函数 向上取整ceil(x)返回的是不小于x的最小整数。如:ceil(2.5) = 3 ceil(-2.5) = -2 round(x) 返回x 阅读全文
posted @ 2023-04-21 23:06 fun-debug 阅读(20) 评论(0) 推荐(0) 编辑
摘要:math.h数学函数 pow(<T> x,<T> y)//x的y次方 阅读全文
posted @ 2023-04-21 23:06 fun-debug 阅读(5) 评论(0) 推荐(0) 编辑
摘要:vector的remove和erase区别 erase: erase函数可以用于删除vector容器中的一个或者一段元素,在删除一个元素的时候,参数上的指针会指向原来的位置 iterator erase(iterator position); iterator erase(iterator firs 阅读全文
posted @ 2023-04-21 23:05 fun-debug 阅读(229) 评论(0) 推荐(0) 编辑
摘要:不定长字符串的输入,保存 对于输入一行随意大小的字符串求其长度并输入指定位上字符,用C++可以编程为: #include<iostream> #include<string> #include<cstring> using namespace std; int main(){ int len; st 阅读全文
posted @ 2023-04-21 23:02 fun-debug 阅读(345) 评论(0) 推荐(0) 编辑
摘要:substr()详解 #include<string> #include<iostream> using namespace std; int main() { string s("12345asdf"); string a = s.substr(0,5); //获得字符串s中从第0位开始的长度为5 阅读全文
posted @ 2023-04-21 23:01 fun-debug 阅读(104) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示