首页    新闻    小组    威客    人才    下载    博客    代码贴    在线编程    论坛
代码贴随便看看C语言
求n个数的平均数和标准差。给定n个数X1 ,X2 ,X3 ......Xn ,数据的平均数为x,标准差定义如下:


图 1: 
输入
第一行一个正整数T,表示有T组测试数据。以下每行是一组数,第一个数为数据个数m(m<200),然后是m个正整数构成,

输出
对于每组数据输出一行,即平均数和标准差,两个数据均保留3位小数,并且以一个空格隔开。

输入样列
2
......................
阅读全部 | qiujiao 贴于 2018年11月10日 22:32     hide bbsi
// rr.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<stdio.h>
int sum1(int n)
{
if(n==1)return 1;
return sum1(n-1)*n;
}

int sum2(int n)
......................
阅读全部 | Mror 贴于 2018年11月5日 22:33     hide bbsi
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
float rabbit;
float tortoise;
void *runner_rabbit(void *param);
void *runner_tortoise(void *param);

int main(int argc, char *argv[])
{
    srand(time(NULL));
......................
阅读全部 | mimijilu 贴于 2018年11月1日 14:27     show bbsi
#include <stdio.h>
main()
{
float height,faHeight,moHeight;
char sex,sports,diet;
printf("请输入被测人信息:性别,是否喜爱运动,是否饮食良好:"); 
scanf("%f,%f,%f,%c,%c,%c",&height,&faHeight,&moHeight,&sex,&sports,&diet);
if(sex=='F' && sports=='Y' && diet=='Y')
    {  
height=((faHeight*0.923+moHeight)/2)*(1+0.02+0.015);
 printf("%f",height);
    }
......................
阅读全部 | 周啦啦 贴于 2018年10月31日 19:25     hide bbsi
float b;

b=1/(3);

printf ("%f\n",b)
阅读全部 | diodes 贴于 2018年10月25日 11:30     hide bbsi
public class Yuman{
        public static void mian(String[] args){
            
        int x=5,y=10;
        if (x<y);
       {
        System.out.println("正确");
       }
           else;
        {
         Sytem.out.println("错误");
         }
......................
阅读全部 | yuyiman330 贴于 2018年10月17日 17:36     hide bbsi
输入十个整数,求最值,并将最小值放在第一个位置,最大值放在最后一个位置
#include <stdio.h>
void main()
{
   int i;
   int s[10];
   int max=0,min=s[9];
   for(i=0;i<10;i++){
    scanf("%d/n",&s[i]);
   } 
   for(i=0;i<10;i++){
    if(s[i]>=max)
......................
阅读全部 | 玖零 贴于 2018年10月13日 00:00     hide bbsi
#include<stdio.h>
#include<windows.h>
#include<stdlib.h>
#include<time.h>
#include<conio.h>
#include<math.h>
#include<algorithm>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
void sxy(int x,int y);
void rand_start(int n);
int ate();
int rbh(int s,int e);
......................
阅读全部 | 拉拉面 贴于 2018年10月6日 22:17     hide bbsi
#include "stdafx.h"
#include "malloc.h"
 #define  STACK_INIT_SIZE  100; 
  #define  STACKINCREMENT   10;  
typedef struct{
  int *base;
  int *top;
  int stacksize;
}sqstack;
void Initstack(sqstack &s)
{
  s.base=(int *)malloc(STACK_INIT_SIZE * sizeof(int));//syntax error : missing ')' before ';'就是这老提示错误
......................
阅读全部 | dlh1234 贴于 2018年9月23日 22:03     hide bbsi
/*
给数的结点增加一个访问次数(visit)属性
遍历左子树,依次入栈
到底后出栈一个元素,判断访问次数是否为2
若不是,则访问次数为1,访问次数+1,再次入栈,T指向右子树(访问右子树),进入下次循环
若是,则输出,T指向空(左右子树都访问了),进入下次循环
*/
 void PostOrderTraversal(BinTree BT)
{
    BinTree T BT;
    Stack S=CreatStack(Maxsize);
    while(T||!IsEmpty(s)){
......................
阅读全部 | Administraor 贴于 2018年9月22日 20:13     hide bbsi
上一页 58 59 60 61 62 63 64 65 66 67 下一页