c++/c
http://wenku.baidu.com/view/639970fdc8d376eeaeaa31a9.html
一,头文件:
c++:
#include<iostream>
Using namespace std//定义输入输出
c
#include <stdio.h>//定义输入/输出函数
#include <stdlib.h>//定义杂项函数及内存分配函数
二,基本输入输出
C:使用printf、scanf、 gets、puts等
C++:使用cin、cout
#include<iostream> using namespace std; void main() { double a,b; cout<<" 输入a:"<<endl; cin>>a; cout<<" 输入b:"<<endl;; cin>>b; cout<<"a+b的数值"<<a+b<<endl; }
#include<stdio.h>
void main()
{
double a,b;
printf(" 输入a:");
scanf("%lf",&a);
printf(" 输入b:");
scanf("%lf",&b);
printf(" a+b的数值为%lf,a+b");
}
三,指针vs引用
(1)指针
1.intp;==定义一个变量P
2.int *p;==定义一个指针p==p指向的内容为int类型==p是返回整数类型的指针
3.int p[3];==p[3]:p是一个数组==int p[3]:数组的元素为int==p是返回整数类型的数组
4.int *p[3];==p[3]:p是一个数组==*p[3]:数组里面的元素是指针==int *p[3]:指针所指的内容是int类型==p是返回整数类型的指针所组成的数组;ps:“[]“优先级〉”*“
5.int (*)p[3];==P是一个指向由整型数据组成的数组的指针;
6.int**p;
posted on 2013-07-30 16:54 Landscape-Mi 阅读(208) 评论(0) 收藏 举报
浙公网安备 33010602011771号