随笔分类 - C++
摘要:1. char数组: 使用scanf("%[^c]",s)可以以c字符为间隔读取字符串。 所以scanf("%[^\n]",s)可以以读取以换行符为间隔读取字符串。 但是它不会吃掉换行符,所以scanf连着用时要用getchar()把中间的换行符吃掉才行。 2. string 使用getline(c
        阅读全文
                
摘要:0. 在有些输入数据很多的变态题中,scanf会大大拖慢程序的时间,cin就更慢了,所以就出现了读入优化。其原理就是一个一个字符的读入,输出优化同理,主要使用getchar,putchar函数。 1. int型读入优化(long long的只要把x改成long long型即可): 2.double型
        阅读全文
                
摘要:#include #include #include using namespace std; const int maxlen=1000; typedef struct node{ //工作记录结点 int adr; //返址 int np; char xp,yp,zp; //值参 }snode; typedef...
        阅读全文
                
摘要:#include #include #define LEN sizeof(PolyNode) typedef struct node{ //声明多项式节点的结构体表示 float coef; //系数 int exp; //指数 struct node* next; }PolyNode; //多项式节点 typedef PolyN...
        阅读全文
                
 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号