C99,C++学习笔记(一)

C99规范:

//java接口是余积,什么是余积,什么是幂等;

(1)抽象、概念性思考、细致面对细节问题;

(2) intmain(){

(3)       float a = 0.812324E10;

(4)       float b = 0.9898E10;

(5)       float c = b - a;

(6)       printf("%f",c);

(7)}

(8)       //大数相减使用浮点数损失精度; 浮点数可能以近似(偏小)的方式存储,故无法表示区域内的所有值;

(9)#为前缀显示符号;

Long long类型(时间转换越界处理);(64位);long(32bit),short(16bit).

计数:unsigned int;    格式说明符匹配类型; \a警报 \f走纸;

C语言八进制,十六进制转义字符;(究竟是什么,环境dev C++; GCC编译器,release)

(10)%c char

C99:字符串和字符的区别:

字符:char;’x’,   “x” 基本类型和派生类型;

串有结束符‘x’和’\0’组成;


*跳过,类似将参数匿名;intn;   scanf(“ %*d  %*d  %d”,  &n);

#include<QCoreApplication>
#include<iostream>
#include<list>
#include<deque>
#include<string>
usingnamespacestd;
/**C语言学习之路;
*#include<stdio.h>
#include<stdlib.h>
#include<inttypes.h>
#include<complex.h>
#include<string.h>
//intmain(void)
//intmain(){
//      floata=0.812324E10;
//      floatb=0.9898E10;
//      floatc=b-a;
//      intd=15;
//      printf("%f,%#f,%o,%#o,%x,%#x,%#X",d,d,d,d,d,d,d);
    //大数相减使用浮点数损失精度;#
//      printf('\o77','\0x89');//C
//      int_fast8_ta1=0;
//      printf("%PRId8",a1);//打印格式待确认;
//      floatcomplexa2;//复数中I表示-1的平方根;虚数类型可选;
//      complexa3;
    //C无字符串类型,使用char*处理字符串
//      printf("%u;\n",sizeof(int));
//      printf("%lu;\n",sizeof(long));
//      printf("%lu",sizeof(unsignedlonglong));
//      printf("$_______\b\b\b\b\b\b\b");
//      printf("%f",2000.00);//&a=2000.00;
//      inti_a;
    '\0',空字符
//      charstr[40]="name123";
//      i_a=strlen(str);
//      printf("%d%d",i_a,sizeof(str));
//
//      printf("%c",'\007');
    //
//      printf("%d%d\n",strlen("name"),sizeof("name"));  //size包含结束符
//      //未给出分配的确定内存,故计算引号之内的所有字符,包含'\0'空字符代表字符串结束;
sizeof(类型)sizeof具体量可不加括号;建议全加;
//
    #defineaa15  #define为替换机制,不是C语句;(规范,常量大写)
//constinta1a=15;
a++;constdefineFINAL常量,onlyread;
//printf("%d\n",a1a);
//
//#defineA15
//intccc=16*A;
//printf("%d,%d\n%u%%%\n%%%c%u",A,ccc,A,'$','$');
//
 
//printf("%d%+f",12,12.0);
//
//#defineA123
//printf("\n%-40d%d",A,sizeof(A));//数字指代宽度
//
//longn=2000000000;
//printf("%.le",n);   //以float类型打印长整型,流程long-float
//而在堆栈中C99处理机制为float默认扩充附近4字节为double8字节;
//之后,将8字节的数据解释为浮点数;
//inta=printf("%.le\n",n);
//
//printf("%d",a);
//
//charpet[30];
//scanf("%s",pet);//C字符数组本来带有引用语义??
//intrrr=15;        scanf("%d",&rrr);
//printf("%d",+12);   //不加中间逗号报错:ownererror
 
//inta=1,b=1,e=1;
//intc,d;
//c=a++;   //赋值后改变a,后加
//printf("%d\n",a);
//intc1=a;
//d=++a;   //赋值前改变a,先加
//printf("%d%d%d\n",c,c1,d);
//所以循环使用++i;
 
//inta=1;
//a++;   //表示一旦对a进行使用,即以某种形式访问了a的值,a会发生变化;
//_Boolc=(a==1);
//printf("%d\n_Bool:%d\n",a,c);
getchar(),putchar();
//inti;
//for(i=1;i<=40;++i){
//      putchar('*');
//}
//putchar('\n');
 
//const&intfoo();
 
//#defineSPACE''
//#defineCOPYRGT"WDD"
//#defineCOPYTIME"20171227"
//#defineWIDTH40
//
//voidshow_char(charch,intnum);
//intmain(){
//      intspace=0;
//      show_char('*',WIDTH);
//      printf("\n");
//
//      show_char(SPACE,18);
//      printf("%s\n",COPYRGT);
//
//      space=(WIDTH-strlen(COPYTIME))/2;
//      show_char(SPACE,space);
//
//      printf("%s\n",COPYTIME);
//      show_char('*',WIDTH);
//      return0;
//}
//
//voidshow_char(charch,intnum){
//      inti;
//      for(i=0;i<num;++i){
//              putchar(ch);
//      }
//}
 
//第二套;
//charSPACE='';
charCOPYRGT[]="WDD";
//char*COPYRGT="WDD";
//charCOPYTIME[]="20171227";
constcharCOPYTIME[]="20171227";
//intWIDTH=40;
//
//voidshow_char(charch,intnum);
//intmain(){
//      intspace=0;
//      show_char('*',WIDTH);
//      printf("\n");
//
//      show_char(SPACE,18);
//      printf("%s\n",COPYRGT);
//
//      space=(WIDTH-strlen(COPYTIME))/2;
//      show_char(SPACE,space);
//
//      printf("%s\n",COPYTIME);
//      show_char('*',WIDTH);
//
//      return0;
//}
//
//voidshow_char(constcharch,constintnum){
//      inti;
//      for(i=0;i<num;++i){
//              putchar(ch);
//      }
//}
 
//intmain(){
//      intre=comp();
//      printf("%lu",re);
//}
//intcomp(){
//      return(2>1)?2:1;
//}
 
//voidexcg(inta);
//intmain(){
//      excg(11);
//      printf("\n");
//      excg(256);
//}
//
//voidexcg(inta){
//      intr=a;
//      if(a>=2){
//              r=a%2;
//              excg(a/2);
//      }
    putchar('0'+r);
//      putchar(r?'1':'0');  //递归实现了反向计算
//}
//所有函数平等,包括main函数可以递归,也可以被其他函数调用;
//intmain(){
    excg(11);
    printf("\n");
    excg(256);
//      inti;
//      for(i=0;i<10;++i){
//              putchar('0'+i);
//      }
//}
//.h/头文件:原型,接口;
intmain(){
    intnight;
    while(scanf("%d",&night)!=1){//以%d过滤至输入整数;
    printf("%s\n","pleaseinputanintegertypenum");
    scanf("%*s");
    }
}
 
 
 
*/
intmain(intargc,char*argv[])
{
 
    QCoreApplicationapp(argc,argv);
    
    list<int>a;
    deque<string>deque_cc;
 
    a.push_front(1);
    a.push_back(10);
    a.push_front(2);
    a.push_front(3);
    a.push_front(4);
    a.push_front(5);
    a.push_back(6);
    a.push_back(7);
    a.push_back(8);
 
//arraylistlistvectormapsetturpledicthashtablestack;
//huffmantreered_blacktreeBtreeB+treetrietree;
//递归(正向局部模块化抽象,执行时回溯),便于反向计算;
 
//同上deque也有四种(顺序线性容器)
//vector四种遍历方法;for循环,for_each内置容器循环,
//iterator游标遍历,copy容器遍历;
//list链式容器,非连续内存,因此操作复杂度为O(1)
//故只能使用游标进行遍历;
 
    deque_cc.push_back("h");
    deque_cc.push_front("i");
 
    deque<string>::iteratordeque_iter;
    for(size_tcount=0;count<deque_cc.size();++count){
        cout<<deque_cc[count]<<endl;
    }
 
    cout<<"###########list###########"<<endl;
 
    list<int>::iteratoriter;
    for(iter=a.begin();iter!=a.end();++iter){
        cout<<*iter<<endl;
    }
/**
*   测试如何动态声明对象数组;
*/  //无构造函数的类和有构造函数的类的区别与联系;
 
    qDebug()<<"**********思路不清晰,暂缓***********"<<endl;
 
//  变量、函数定义与声明的区别;
    //
    //声明和定义的区别:
    //
    //为什么函数要声明,理解到函数名是指向函数的指针;
    //定义就是初始化(给函数返回值;)指针变量使用前肯定;
    //要定义和初始化;老版本编译器是不支持void类型的返回值;
    //因为这个意思就是函数指针被初始化为nullptr,理解为访存错误;
 
    //函数的本质是一个自包含单元??闭包?->自反,对称,传递?
    //(自包含是指组件重用时不需要包含其他的可重用组件),(自描述
    //是指使用元数据以非特定语言描述代码中定义的每一类型和成员)
    //
    //
    //
    returnapp.exec();
}
 //未完,待续


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值