// 1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
int main(int argc, char* argv[])
{
int i,j,k;
float a[3][4][5],submax[j],submin[j],subz,subave; //3个班级 4个科目 5个学生
for(i=0;i<=2;i++)
{
......................
阅读全部
|
naughty14
贴于 2014年11月9日 11:34
hide
bbsi
#include <stdio.h>
#include <string.h>
#define maxn 20
int a[maxn][maxn];
int main(int argc, char *argv[])
{
int n,x,y,tot=0;
scanf("%d",&n);
memset(a,0,sizeof(a));
tot=a[x=0][y=n-1]=1;
while(tot<n*n)
{
......................
阅读全部
|
neo1218
贴于 2014年11月7日 17:57
hide
bbsi
#include<stdio.h>
#include<malloc.h>
#define LEN sizeof(struct Student)
void main()
struct Student //结构体声明
{
long num;
int score;
struct Student* next;
};
int n;
阅读全部
|
dzhack
贴于 2014年11月6日 15:13
hide
bbsi
#include<stdio.h>
#include<malloc.h>
#define LEN sizeof(struct Student)
void main()
struct Student //结构体声明
{
long num;
int score;
struct Student* next;
};
int n;
阅读全部
|
dzhack
贴于 2014年11月6日 15:13
hide
bbsi
#include<stdio.h>
#include<string.h>
int count_chars(char const*str,char const*chars)
{
int a=strlen(str);
int b=strlen(chars);
printf("%d %d\n",a,b);
int i,j;
int count=0;
for(i=0;i<b;i++,chars++)
for(j=0;j<a;j++,str++)
if(*str==*chars)
......................
阅读全部
|
徐学贵
贴于 2014年11月4日 22:56
hide
bbsi
#include<stdio.h>
#include<string.h>
#define N 4
struct student
{
int xh;
char mz[20];
char xb;
int bj;
float yw;
float sx;
float yy;
......................
阅读全部
|
小神童
贴于 2014年11月4日 02:22
hide
bbsi
#include<stdio.h>
#include<stdlib.h>
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
#define ElemType int
typedef struct LNode
{
ElemType data;
struct LNode *next;
int length;
}LNode, *LinkList;
......................
阅读全部
|
千里孤坟
贴于 2014年11月1日 22:50
hide
bbsi
#ifndef _List_H
#define _List_H
typedef int ElementType;
struct Node;
typedef struct Node *PtrToNode;
typedef PtrToNode List;
typedef PtrToNode Position;
List MakeEmpty();
int IsEmpty(List L);
int IsLast(Position P, List L);
......................
阅读全部
|
fdjiangwu
贴于 2014年11月1日 20:45
hide
bbsi
/*
*Author: fdjiangwu
*Date: 2014.11.1
*Function: 给定整数A1,A2,...,AN(可能是负数),求最大子序列的和,如果所有元素全是负数,认为是0
*Algorithm: 算法1和算法2略。算法3为递归算法,算法4技巧性强,需掌握递归算法
*/
#include <stdio.h>
int MaxSubsequenceSumUseAlgo1(const int A[], int N);
int MaxSubsequenceSumUseAlgo2(const int A[], int N);
int MaxSubsequenceSumUseAlgo3(const int A[], int N);
int MaxSubsequenceSumUseAlgo4(const int A[], int N);
......................
阅读全部
|
fdjiangwu
贴于 2014年11月1日 14:32
hide
bbsi
/*
*Author: fdjiangwu
*Date: 2014.11.1
*Function: 大小为N的数组A,其主要元素是一个出现次数超过N/2次的元素,
* 如果数组中存在该元素,则找到该元素。
*Algorithm: 首先,找到主要元素的一个候选元(这是难点)。这个候选元是唯一有可能是主要元素的元素。
* 然后,确定该候选元是否就是主要元素。这正好是对数组的顺序搜索。
* 找到候选元的方法:为找到数组A的一个候选元,构造第二个数组B。
* 比较A1和A2,如果它们相等,则取其中之一到数组B中,否则什么都不做。
* 然后比较A3和A4,同样地,如果它们相等,则去其中之一到B中,否则什么都不做。
* 按照这种方式继续,直到读完这个数组。
* 然后递归地寻找数组B中的候选元,它也是A中的候选元。
......................
阅读全部
|
fdjiangwu
贴于 2014年11月1日 13:05
hide
bbsi