something about Cpp begin

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include
using namespace std;
namespace bite
{
void print(int a)
{
printf("%d \n", a);
}
int a;
int b;
namespace bite_69
{
void fun1(int a)
{
printf("%d \n", a);
}
int a;
int b;
}
}
namespace bite
{
int c;
int d;
void fun2()
{
printf(“fun2()\n”);
}
void fun3()
{
printf(“fun3()\n”);
}
}

void fun1(int a)
{
printf("%d \n", a);
}

void print(int a)
{
printf("%d \n", a);
}
int a;
int b;

using bite::fun3;

void test()
{
bite::a = 1;
bite::print(bite::a);
bite::print(a);
bite::bite_69::a = 2;
bite::c = 3;
bite::fun2();
bite::fun3();
fun3();
}

void test2()
{
int a = 10;
//int b;
printf("%d\n", a);
//scanf("%d", &b);

std::cout << a << "\n"<<std::endl;
//std::cin >> b>>a;
const char* p = "1234";
int* pa = &a;
std::cout << pa << std::endl;//非字符串指针输出地址
std::cout << p << std::endl;//字符串指针输出内容

}

void fun5(int a=1, int b=2, int c=3)
{
std::cout << a << b << c << std::endl;
}

int Add(int a, int b)
{
return a + b;
}

float Add(float a, float b)
{
return a + b;
}

int Add(int a, int b, int c)
{
return a + b + c;
}

int Add(char a, int b)
{
return a + b;
}

int Add(int b, char a)
{
return a + b;
}

//extern “C”
//{
// int sub(int a, int b);
// int mul(int a, int b);
//}
void test4()
{
int a = 1;
int b = 2;
float c = 1.5;
float d = 2.5;
char f = ‘a’;
int e = 3;
Add(a, b);
Add(c, d);
Add(a, b, e);
Add(a, f);
Add(f, a);
}

//void test5()
//{
// sub(4, 2);
//}

void test6()
{
int a = 10;
int& ra = a;
int& ra2 = a;
cout << &a << endl;
cout << &ra << endl;
cout << &ra2 << endl;
}

void test7()
{
const int a = 10;
const int& ra = a;
const int& r = 10;
double d = 2.0;
double& rd = d;
int c = d;
const int& rd2 = d;
}

void Swap(int& ra, int& rb)
{
int tmp = ra;
ra = rb;
rb = tmp;
}
int main()
{
//test2();
//fun5(300,200,100);
//test4();
//test5();
//test6();
test7();
return 0;
}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值