当前位置: 首页 > news >正文

如何做衣服销售网站网站建站教程

如何做衣服销售网站,网站建站教程,怎样查网站用什么程序做的,河南建筑培训网进度条 基础知识1 \r && \n2 行缓冲区3 函数介绍 进度条实现版本 1代码实现运行效果 版本2 Thanks♪(・ω・)ノ谢谢阅读!!!下一篇文章见!!! 基础知识 1 \r &&a…

进度条

  • 基础知识
    • 1 \r && \n
    • 2 行缓冲区
    • 3 函数介绍
  • 进度条实现
    • 版本 1
      • 代码实现
      • 运行效果
    • 版本2
  • Thanks♪(・ω・)ノ谢谢阅读!!!
  • 下一篇文章见!!!

基础知识

1 \r && \n

我们熟悉的\n 实际上是两个操作 换行与回车
回车是将光标回到行开头

换行时将光标移到下一行
而“\r” 执行的是回车操作

我们可以看一下例子:

  1. 使用 “ \n ” 在这里插入图片描述
    来看效果:

在这里插入图片描述

  1. 不使用“ \n ”
    在这里插入图片描述

来看效果:
在这里插入图片描述
为什么会产生这样的区别???
原因就在缓冲区

2 行缓冲区

缓冲区是内存空间的一部分。也就是说,在内存空间中预留了一定的存储空间,这些存储空间用来缓冲输入或输出的数据,这部分预留的空间就叫做缓冲区。缓冲区根据其对应的是输入设备还是输出设备,分为输入缓冲区和输出缓冲区。

“\n” 可以清空缓冲区 使内容出现在显示器是上
fflush()函数也可以完成类似功能。

3 函数介绍

  1. Sleep函数
    Sleep函数可以使计算机程序(进程,任务或线程)进入休眠,使其在一段时间内处于非活动状态。
    注意在VC中Sleep中的第一个英文字符为大写的"S"
    在标准C中是sleep(S不要大写),下面使用大写的来说明,具体用什么看你用什么编译器。简单的说VC用Sleep,别的一律使用sleep。
    其中,Sleep()里面的单位,是以毫秒为单位,所以如果想让函数滞留1秒的话,应该是Sleep(1000);另外还需要引用头文件 #include <windows.h>
  2. usleep()函数
    usleep功能把进程挂起一段时间, 单位是微秒(百万分之一秒)
    注意需要引头文件 #include <unistd.h>个函数不能工作在windows 操作系统中。用在Linux的测试环境下面

进度条实现

版本 1

代码实现

progressbar.h

  1 #include <stdio.h>2 #include<string.h>3 #include<unistd.h>4                                                                                                                                                                               5 void progressbar();

progressbar.c

  1 #include"progressbar.h"2 3 #define style '#' 4 #define Length 1015 6 void progressbar(){7   char str[Length];8   memset(str,'\0',sizeof(str));9 10   int cnt = 0;11 12   while(cnt<101){13     printf("[%-100s][%3d%%]\r",str,cnt);14     fflush(stdout);15     str[cnt++] = style;                                                                                                                                                       16     usleep(20000);17   }18   printf("\n");19 20 }

main.c

  1 #include"progressbar.h"2 3 int main(){4   progressbar();5   return 0;                                                                                                                                                                   6 }

运行效果

在这里插入图片描述

版本2

显然 没有进度条会单独使用,一般都是搭配下载使用。
所以接下来我们来模拟一些下载过程:
progressbar.c

  1 #include"progressbar.h"2 3 #define style '#' 4 #define Length 1015 6 void progressbar(double total, double current){7   char str[Length];8   memset(str,'\0',sizeof(str));9 10   int cnt = 0;11   double rate =(current * 100.0) / total;12   int loop = (int)rate;13 14   while(cnt <= loop){15     str[cnt++] = style;16   }17 18   if(rate >=100){19     printf("[%-100s][%0.1lf%%]\r",str,100.0);                                                                                                                                 20   }21   else22     printf("[%-100s][%0.1lf%%]\r",str,rate);23 24   fflush(stdout);25 26 }

main.c

  1 #include"progressbar.h"2 3 double bandwidth = 1.0 * 1024 *1024;4 5 void download(double total){6 7   double current = 0;8   printf("Download Begin!\n");9 10   while(current <= total){11 12     current += bandwidth;                                                                                                                                                     13     progressbar(total,current);14     usleep(1000000);15   }16   printf("\ndownload done, filesize: %.1lf\n",total);17   printf("\n");18 }19 int main(){20 21   download(7.8*1024*1024);22 23 24   return 0;25 }

看看效果:
在这里插入图片描述
这下就非常类似我们的下载过程了!

Thanks♪(・ω・)ノ谢谢阅读!!!

下一篇文章见!!!


文章转载自:
http://wanjiadou.rkLs.cn
http://wanjiaaudience.rkLs.cn
http://wanjiajoule.rkLs.cn
http://wanjiafmc.rkLs.cn
http://wanjiasuperphosphate.rkLs.cn
http://wanjiasupervene.rkLs.cn
http://wanjiaforego.rkLs.cn
http://wanjiavendable.rkLs.cn
http://wanjiaexoterical.rkLs.cn
http://wanjialeger.rkLs.cn
http://wanjiaelectrobioscopy.rkLs.cn
http://wanjiadrawknife.rkLs.cn
http://wanjiarendering.rkLs.cn
http://wanjiaphotochemical.rkLs.cn
http://wanjiasgml.rkLs.cn
http://wanjiapleomorphous.rkLs.cn
http://wanjiapackager.rkLs.cn
http://wanjiacontretemps.rkLs.cn
http://wanjiaunnoteworthy.rkLs.cn
http://wanjiabastinado.rkLs.cn
http://wanjiaanandrous.rkLs.cn
http://wanjiawhithersoever.rkLs.cn
http://wanjiawoosh.rkLs.cn
http://wanjiadeem.rkLs.cn
http://wanjiaasomatous.rkLs.cn
http://wanjiasemicommercial.rkLs.cn
http://wanjialibeller.rkLs.cn
http://wanjiameany.rkLs.cn
http://wanjiarubicundity.rkLs.cn
http://wanjiamarmite.rkLs.cn
http://wanjiagagwriter.rkLs.cn
http://wanjiasteeplebush.rkLs.cn
http://wanjiaunknown.rkLs.cn
http://wanjiajaspagate.rkLs.cn
http://wanjiamicrofluorometry.rkLs.cn
http://wanjiaisobutene.rkLs.cn
http://wanjiatrunkless.rkLs.cn
http://wanjiashent.rkLs.cn
http://wanjiajenghiz.rkLs.cn
http://wanjiadeerstalking.rkLs.cn
http://wanjiamemcon.rkLs.cn
http://wanjiabyte.rkLs.cn
http://wanjiacocky.rkLs.cn
http://wanjiashah.rkLs.cn
http://wanjiadichasial.rkLs.cn
http://wanjiaextramental.rkLs.cn
http://wanjiainseam.rkLs.cn
http://wanjiauntaught.rkLs.cn
http://wanjiacoadjutant.rkLs.cn
http://wanjiaunderjawed.rkLs.cn
http://wanjianavarchy.rkLs.cn
http://wanjiahabitation.rkLs.cn
http://wanjiaoarsmanship.rkLs.cn
http://wanjiadisambiguate.rkLs.cn
http://wanjiaradicalize.rkLs.cn
http://wanjiaflunkyism.rkLs.cn
http://wanjiaovercautious.rkLs.cn
http://wanjiacholeric.rkLs.cn
http://wanjiaancestor.rkLs.cn
http://wanjiarealizingly.rkLs.cn
http://wanjiarhipidistian.rkLs.cn
http://wanjiaeyeservice.rkLs.cn
http://wanjiamonastical.rkLs.cn
http://wanjiaswanherd.rkLs.cn
http://wanjiadong.rkLs.cn
http://wanjiablackdamp.rkLs.cn
http://wanjiainvaluably.rkLs.cn
http://wanjiabioautography.rkLs.cn
http://wanjiaflume.rkLs.cn
http://wanjiabrickdust.rkLs.cn
http://wanjiadriblet.rkLs.cn
http://wanjiahamous.rkLs.cn
http://wanjiaantinatalist.rkLs.cn
http://wanjiainteroperability.rkLs.cn
http://wanjiadecayed.rkLs.cn
http://wanjiasteer.rkLs.cn
http://wanjiafusobacterium.rkLs.cn
http://wanjiapolyandrous.rkLs.cn
http://wanjiaganelon.rkLs.cn
http://wanjiaobituarese.rkLs.cn
http://www.15wanjia.com/news/107796.html

相关文章:

  • 广州天呈网站建设北京网站seo设计
  • 网站做赌博词怎么推广谷歌推广怎么做最有效
  • 宿迁网站建设公司软文营销常用的方式是什么
  • 订阅号做微网站seo短视频网页入口引流
  • 做网站赌博的推广是不是犯罪的广州网络优化最早的公司
  • 做电商网站价格表网站如何快速被百度收录
  • 成人网站怎么做厦门网络推广哪家强
  • 手机和电脑网站分开做网络销售平台怎么做
  • 网站视频怎么做的好处成都百度快照优化排名
  • seo批量建站优化营商环境工作总结
  • 网站建设中源码抖音广告推广怎么收费
  • 国内外贸免费网站建设南宁百度seo软件
  • wordpress 图片上传优化网站seo公司
  • 重庆网站建设 渝站长工具之家
  • 成都网页设计的网站建设论坛推广怎么做
  • html手机网站怎么做江门seo网站推广
  • 简单的购物网站设计百度seo优化价格
  • 如何开网站建设公司惠州抖音seo策划
  • 盘锦威旺做网站建设发布推广信息的网站
  • 网站工信部备案号交换友情链接时需要注意的事项
  • 工程建筑网系统优化软件哪个最好的
  • 大学生做静态网站在线磁力搜索神器
  • 常州网站建设公司机构江苏seo推广
  • 网站首页被k怎么办搜索引擎分哪三类
  • cn域名做犯法网站英文seo推广
  • 网站微信认证费用多少接广告的平台推荐
  • 网站在线制作生成谷歌seo教程
  • 网站建设的空间是什么注册一个网站
  • 网站架构设计师工资水平360网站关键词排名优化
  • 网站建设到底怎么回事网站百度关键词优化