上一页 1 ··· 332 333 334 335 336 337 338 339 340 ··· 403 下一页
摘要: 1、原始程序, 使以下程序在接收负数时不换行 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); while (i >= 0) { 阅读全文
posted @ 2021-04-18 21:53 小鲨鱼2018 阅读(354) 评论(0) 推荐(0)
摘要: 1、do语句; #include <stdio.h> int main(void) { int a, b, min, max, sum = 0; puts("please input two integers."); printf("a = "); scanf("%d", &a); printf(" 阅读全文
posted @ 2021-04-18 21:24 小鲨鱼2018 阅读(1811) 评论(0) 推荐(0)
摘要: c语言中使程序执行任意次数。 (1)、可选的任意次数 do语句 #include <stdio.h> int main(void) { int j; do { int i; puts("please input an integer."); printf("i = "); scanf("%d", & 阅读全文
posted @ 2021-04-18 18:09 小鲨鱼2018 阅读(596) 评论(0) 推荐(0)
摘要: c语言中程序的循环控制,do语句输入两个整数,计算它们之间的所有整数的和。 1、do语句 #include <stdio.h> int main(void) { int a, b, min, max, sum = 0; puts("please input two integers."); prin 阅读全文
posted @ 2021-04-18 17:46 小鲨鱼2018 阅读(1524) 评论(0) 推荐(0)
摘要: 1、奇数 #include <stdio.h> int main(void) { int i; puts("please input an integer."); printf("i = "); scanf("%d", &i); while(i > 0) { if (i % 2) printf("% 阅读全文
posted @ 2021-04-18 12:49 小鲨鱼2018 阅读(399) 评论(0) 推荐(0)
摘要: linux系统中sort命令。 1、测试数据 [root@centos7 test2]# cat a.txt google 110 5000 baidu 100 5000 guge 50 3000 sohu 100 4500 2、默认按照第一列排序 [root@centos7 test2]# sor 阅读全文
posted @ 2021-04-17 23:25 小鲨鱼2018 阅读(308) 评论(0) 推荐(0)
摘要: R语言中rnorm函数。(正态分布) 1、基本用法 norm(n, x, y): 产生n个平均数为x,标准差为y的数。 默认情况下,平均数为0, 标准差为1. > a <- rnorm(10) > a [1] 0.08629733 -0.31750665 1.51152649 -0.60992255 阅读全文
posted @ 2021-04-17 22:57 小鲨鱼2018 阅读(4944) 评论(0) 推荐(0)
摘要: 1、 dat <- data.frame(v1=sample(1:15,15),v2=sample(1:15,15)) dat$cat[dat$v1 <= 8] <- "SMALL" dat$cat[dat$v1 > 8 ] <- "BIG" 2、 dat <- data.frame(v1=samp 阅读全文
posted @ 2021-04-17 20:42 小鲨鱼2018 阅读(4971) 评论(0) 推荐(0)
摘要: R语言中求数据框每一列的最大值、最小值、平均数、中位数、方差和标准差 1、 d <- data.frame(v1=sample(1:10,6),v2=sample(1:10,6),v3=sample(1:10,6), v4=sample(1:10,6)) rmax <- vector() rmin 阅读全文
posted @ 2021-04-17 18:29 小鲨鱼2018 阅读(15401) 评论(0) 推荐(0)
摘要: 1、测试数据 a <- c(8,4,7,6,2,5) 2、最大值、最小值 > max(a) [1] 8 > min(a) [1] 2 3、平均数、中位数 > mean(a) [1] 5.333333 > median(a) [1] 5.5 4、方差、标准差 > var(a) [1] 4.666667 阅读全文
posted @ 2021-04-17 18:15 小鲨鱼2018 阅读(9866) 评论(0) 推荐(0)
上一页 1 ··· 332 333 334 335 336 337 338 339 340 ··· 403 下一页