摘要: (36条消息) “懒人”的福音 泛型编程_Loving_Forever_的博客-CSDN博客 阅读全文
posted @ 2022-03-03 16:42 Dsad123FFFG6645 阅读(33) 评论(0) 推荐(0)
摘要: char只表示一个字符,若重复赋值,则或者会覆盖前者: char ch='qwqewqe'; cout<<ch<<endl; 输出:e 因为char只有一个字符,后者会覆盖前者。 2、char * src表示字符串char *src="qwqewqe"; cout<<src<<endl;这里的src 阅读全文
posted @ 2022-03-02 22:14 Dsad123FFFG6645 阅读(195) 评论(0) 推荐(0)
摘要: return x==5; //x=5则返回true int reverse(int x){ int ret=0,max=0x7fffffff,min=0; long rs=0; for(;x;rs=rs*10+x%10,x/=10);、// 循环判断 表达式2(循环条件):x为真 表达式3 两个操作 阅读全文
posted @ 2022-03-02 17:36 Dsad123FFFG6645 阅读(67) 评论(0) 推荐(0)
摘要: bool 函数 要return 0 * bool initlist(node*& temp) { temp = new node;if(!temp)if (temp == NULL) return false; temp->next = NULL;return true;} “\n” 和endl 效 阅读全文
posted @ 2022-03-02 15:52 Dsad123FFFG6645 阅读(8) 评论(0) 推荐(0)
摘要: (35条消息) c++ stringstream(老好用了)_jllongbell的博客-CSDN博客_stringstream int 转换成string //stringstream 类 stringstream stream; int a =123; string str; stream<< 阅读全文
posted @ 2022-03-01 20:04 Dsad123FFFG6645 阅读(12) 评论(0) 推荐(0)
摘要: #include <iostream>#include <string>#include <algorithm> using namespace std; void reverseString(string &s){ int i, j; for (i = 0, j = s.size() - 1; i 阅读全文
posted @ 2022-03-01 15:23 Dsad123FFFG6645 阅读(40) 评论(0) 推荐(0)
摘要: class Solution: def isPalindrome(self, x: int) -> bool:#self不用管 参数是int 型的x 函数返回结果是布尔型的 y = str(x)#str 就是一个python内置函数 就是读取字符串 return x >= 0 and y == y[ 阅读全文
posted @ 2022-02-28 18:05 Dsad123FFFG6645 阅读(37) 评论(0) 推荐(0)
摘要: # 成员函数: 实例的方法, 只能通过实例进行调用;class Person:grade=1def __init__(self,name):self.name = name def sayHi(self):#加 self 区别于普通函数print 'Hello, your name is?',sel 阅读全文
posted @ 2022-02-28 17:50 Dsad123FFFG6645 阅读(29) 评论(0) 推荐(0)
摘要: 实例 使用名为 x 的属性,创建一个名为 MyClass 的类: class MyClass: x = 5 运行实例 创建对象 现在我们可以使用名为 myClass 的类来创建对象: 实例 创建一个名为 p1 的对象,并打印 x 的值: p1 = MyClass() print(p1.x) 运行实例 阅读全文
posted @ 2022-02-28 17:49 Dsad123FFFG6645 阅读(27) 评论(0) 推荐(0)
摘要: // Type your code here, or load an example.#include <bits/stdc++.h>using namespace std;#define rep(i,a,b) for (int i =(a);i<(b);++i)//宏定义要多加括号#define 阅读全文
posted @ 2022-02-28 16:17 Dsad123FFFG6645 阅读(36) 评论(0) 推荐(0)