c/c++基础
文章平均质量分 67
黄色沙琪玛
这个作者很懒,什么都没留下…
展开
-
c语言实现:将字符串颠倒,12345678变成 87654321
#include #include /**实现字符数组将字符串颠倒,12345678--876543211、先用数组的方式 先求出长度 如果是基数怎么颠倒 如果是偶数怎么颠倒2、用指针的方式*/int main(){ char hj[100] ="1234567890"; int length =0; //检查字符串的长度 for (int i=0;i <100;i+原创 2015-01-07 19:41:50 · 3673 阅读 · 0 评论 -
Maven系列--pom.xml 配置详解
http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">转载 2015-07-19 18:17:11 · 246 阅读 · 0 评论 -
线性表链式存储的实现详解
本文原文地址:http://blog.csdn.net/j903829182/article/details/38173681#include #include //线性表的链式存储和实现,带头点 #define true 1 #define false 0 typedef int DataType;//定义抽象数据类型 //节点的结构体 typedef struct转载 2015-03-19 20:40:38 · 415 阅读 · 0 评论 -
C++实现四种三角形的打印
1、左上角方式int main(){for (int i=0; i2、右上角方式:int mainyoushangjiao(){for (int i=0;ij){printf(" ");}else{printf("%5d",j);}}printf("\n");}getchar();return 0;}原创 2014-12-30 17:41:37 · 3705 阅读 · 0 评论 -
实现数组插入排序并输出
实现排序输出#include#includeusing namespace std;class intarray{ int *p;//指针指向首地址 int N;//确定有多少元素 public: intarray(int size) { N = size;//接受多少个元素 p = new int[N];; } void setnum(int id,原创 2015-02-01 22:01:41 · 457 阅读 · 0 评论 -
c++排序从小到大随机排序输出
c++排序从小到大随机排序输出:#include "stdafx.h"#include#includeusing namespace std;int main(){ int a[30]; for (int i=0; i<10;i++) { a[i] = rand()%300; cout<<"a["<<i<<"]="<<a[i]<<endl; } int mi原创 2015-01-30 12:11:06 · 2582 阅读 · 0 评论 -
使用指针数组作为索引
#include "stdafx.h"#include#includeusing namespace std; //建立一个指针指向结构体struct str{ int num; char name[50];};int main(){ str STU[5]; STU[0].num = 100; strcpy(STU[0].name,"张三"); STU[1].n原创 2015-01-31 15:25:05 · 1558 阅读 · 0 评论 -
c++实现冒泡排序
c++实现冒泡排序#include "stdafx.h"#include#includeusing namespace std;void main(){ int a[120]; for (int i=0;i<10;i++) { a[i] = rand()%200; cout<<"a["<<i<<"]="<<a[i]<<endl; } for (int i=0;i<原创 2015-01-30 22:13:00 · 351 阅读 · 0 评论 -
c++实现选择排序
用c++实现选择排序:#include "stdafx.h"#include#includeusing namespace std;int main(){ int a[30]; for (int i=0; i<10;i++) { a[i] = rand()%300; cout<<"a["<<i<<"]="<<a[i]<<endl; } int minNum =原创 2015-01-30 12:03:10 · 393 阅读 · 0 评论 -
c++指针实现2数交换
#include #include void main(){ /*int a, *b; b = &a; int hj = 10; int *p; p = &hj; printf("%d", p);*/ int a, b; scanf("%d%d",&a, &b); printf("%d ,%d",a, b); int *p1 = &a; int *p2 = &b; i原创 2016-11-11 07:36:46 · 550 阅读 · 0 评论