1,C++中操作数组
#include
using namespace std;
int length(char []);
void output_frequency(char []);
int main()
{
char str[]="yan cong min";
cout<<"要处理的字符串为:"<<str<<endl;
cout<<"字符串长度为:"<<lengt...
分类:
编程语言 时间:
2014-05-05 13:29:30
阅读次数:
432
??
#include
#include
typedef struct emp{
char sex[8];
char name[15];
int age;
}*emp;//这里我们用typedef把emp这个结构体变成了*emp这种指向结构体成员的结构体指针
/*typedef struct emp{
char sex[8];
char name[15];
int...
分类:
编程语言 时间:
2014-05-05 12:54:29
阅读次数:
277
这篇对应的是习题16,读写文件
# -*- coding: utf-8 -*-
#对文件更多操作复制A文件的内容到B文件
#from sys import argv
from os.path import exists
prompt = "> "
from_file = raw_input("please input the filename where you want to copy...
分类:
编程语言 时间:
2014-05-05 12:54:02
阅读次数:
402
题目:给定一个n*m大的纸张,上面表明了每块上的字母,在其背后给定了对应位置的字母的value,在最后给出需要剪出来的剪纸的字母序列。
方法:暴力搜索。
代码:
#include
#include
#include
#include
using namespace std;
char map[502][502];
int Map[502][502];
int vis[502][502...
分类:
其他好文 时间:
2014-05-05 12:53:36
阅读次数:
338
// BTree.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include"stdlib.h"
#include"malloc.h"
#define BT BTreeNode
#define MS 10
typedef struct BT{
char data;
struct BT *left;
struct BT *right;
}BT;
...
分类:
其他好文 时间:
2014-05-04 12:45:34
阅读次数:
365
移位运算符就是在二进制的基础上对数字进行平移。按照平移的方向和填充数字的规则分为三种:
>(带符号右移)和>>>(无符号右移)。
在移位运算时,byte、short和char类型移位后的结果会变成int类型,对于byte、short、char和int进行移位时,规定实际移动的次数是
移动次数和32....
分类:
编程语言 时间:
2014-05-03 23:01:12
阅读次数:
491
1 typedef 和 define
的区别#define是简单的替换;typedef是别名!12#define pchar char *pchar a,b;//展开后 char
*a,b;a为指针,b不是12typedef char* pchar;pchar a,b;//a b均为指针2.注释3接...
分类:
其他好文 时间:
2014-05-03 22:48:35
阅读次数:
401
第1部分 重新认识C语言C语言中常用的文件操作函数总结及使用方法演示代码 1. C语言中常用的文件操作函数总结(1) fopen作用:打开文件。表头文件:#include 定义函数:FILE *fopen(const char *path, const char *mode);函数说明:参数path字符串包含欲打开的文件路径及文件名,参数mode字符串则代表着流形态。mode有下列几种形态字符串:...
分类:
其他好文 时间:
2014-05-03 21:38:17
阅读次数:
279
C# 中 PadLeft和PadRight 的用法
在 C# 中可以对字符串使用 PadLeft 和 PadRight 进行轻松地补位。
PadLeft(int totalWidth, char paddingChar) //在字符串左边用 paddingChar 补足 totalWidth 长度
PadRight(int totalWidth, char paddingChar...
分类:
其他好文 时间:
2014-05-03 20:50:32
阅读次数:
513
C++开发的项目难免会用到STL的string,使用管理都比char数组(指针)方便的多,但在得心应手的使用过程中也要警惕几个小陷阱,避免我们项目出bug却迟迟找不到原因。
1. 结构体中的string赋值问题
直接通过一个例子说明,下面的例子会输出什么:
#include
#include
#include
using namespace std;
stru...
分类:
编程语言 时间:
2014-05-03 16:09:23
阅读次数:
289