❶ 谁那有流程图的c语言实现的实例,比较复杂点多重嵌套的流程图实现,最好有源代码,不胜感激啊!
去网络文库搜搜吧,比较丰富,而且很多免费的
❷ C程序流程图例子,用VISIO如何画这个流程图,麻烦大家画出来一下,谢谢了
显然第一种,第二种判断完 X<10 之后,路线就断了。
但是还要在 Z>20 上面加上 当Z>20 为 NO 时,直接跳过 dosomething4 直接进入 Y++...
❸ 用C语言写出下例的流程图:
#include <stdio.h>
#include <math.h>
#define PI 3.1415926
void circle()
{
double d,s,l;
printf("Please input the diameter:");
scanf("%lf",&d);
s=d*d*PI/4;
l=d*PI;
printf("zhou chang is :%lf\n",l);
printf("area is :%lf\n\n",s);
}
void square()
{
double a,l,s;
printf("Please input the bianchang:");
scanf("%lf",&a);
s=a*a;l=4*a;
printf("zhou chang is :%lf\n",l);
printf("area is :%lf\n\n",s);
}
void rectangle()
{
double a,b,l,s;
printf("Please input the length and the width:");
scanf("%lf %lf",&a,&b);
s=a*b;l=2*(a+b);
printf("zhou chang is :%lf\n",l);
printf("area is :%lf\n\n",s);
}
void triangle()
{
double a,b,c,l,s;
printf("Please input the three bian:");
scanf("%lf %lf %lf",&a,&b,&c);
l=a+b+c;s=sqrt(l/2*(l/2-a)*(l/2-b)*(l/2-c));
printf("zhou chang is :%lf\n",l);
printf("area is :%lf\n\n",s);
}
main()
{
int sec;
printf("1----is circle.\n");
printf("2----is square.\n");
printf("3----is rectangle.\n");
printf("4----is circle.\n");
printf("0----is triangle.\n");
printf("select the type you want to:");
scanf("%d",&sec);
while(sec) {
switch(sec) {
case 1:circle();break;
case 2:square();break;
case 3:rectangle();break;
case 4:triangle();break;
}
printf("1----is circle.\n");
printf("2----is square.\n");
printf("3----is rectangle.\n");
printf("4----is circle.\n");
printf("0----is triangle.\n");
printf("select the type you want to:");
scanf("%d",&sec);
}
}
❹ 求C语言流程图(程序如下)
/*找9张牌给card*/
for (deckp = 0; deckp < size; deckp++)
{
div_t card = div(deck[deckp], SUITSIZE);
cards[deckp].val = "A23456789TJQK"[card.rem]; /*把余数给card.val*/
cards[deckp].kind = "3456"[card.quot]; /*把商给card.kind*/
}
}
/*show的原代码,将会自动换行*/
void show(const Card *cards, int size)
{
for(int i = 0; i < size; i++)
{
printf("%c%c ",cards[i].kind,cards[i].val);
if( (i !=0) && (((i+1 ) % 3) == 0))
puts("");
}
puts(""); /*自动换行*/
}
/*grouping 的原代码*/
void grouping(const Card *cards, Card *carr1, Card *carr2, Card *carr3)
{
int i = 0;/*循环参数*/
/*分给carr1三个数*/
while (i < 3)
{
carr1[i].val = cards[i].val;
carr1[i].kind = cards[i].kind;
i++;
}
/*分给carr2接下来的三个数*/
while (i < 6)
{
carr2[i-3].val = cards[i].val;
carr2[i-3].kind = cards[i].kind;
i++;
}
/*分给carr3接下来的三个数*/
while (i < 9)
{
carr3[i-6].val = cards[i].val;
carr3[i-6].kind = cards[i].kind;
i++;
}
}
/*rshift的实现*/
void rshift(Card *carr1, Card *carr2, Card *carr3, int counter)
{
Card temp2;/*用于存放carr2[counter]*/
Card temp3;/*用于存放carr3[counter]*/
/*temp = carr2*/
temp2.val = carr2[counter].val;
temp2.kind = carr2[counter].kind;
/*carr2 = carr1*/
carr2[counter].val = carr1[counter].val;
carr2[counter].kind = carr1[counter].kind;
/*temp3 = carr3*/
temp3.val = carr3[counter].val;
temp3.kind = carr3[counter].kind;
/*carr3 = carr2*/
carr3[counter].val = temp2.val;
carr3[counter].kind = temp2.kind;
/*carr1 = carr3*/
carr1[counter].val = temp3.val;
carr1[counter].kind = temp3.kind;
}
Card* result_process(Card *carr1, Card *carr2, Card *carr3, int counter)
{
rshift(carr1, carr2, carr3, counter); /* 把数组的第一个元素依次右移*/
if(counter == 2)
{
return(&carr2[2]);
}
show(carr1, 3);
show(carr2, 3);
show(carr3, 3);
puts("请给出你记住的牌所在行数:");
fflush(stdin);
int input = 1;
input = getchar(); /*获取你选的组*/
switch(input)
{
case '1':
return(result_process(carr1, carr2, carr3, ++counter));
break;
case '2':
return(&carr2[counter]);
break;
default:
puts("你在撒谎!不和你玩了!");
return NULL;
}
}
❺ c语言简单流程图题目求解
#include<stdio.h>
#include<math.h>
//自己根据需求换函数
doublef(doublex)
{
returnx*x*x-1.5;
}
intmain(void)
{
doubleP=1e-4;
doublea,b,c;
printf("Pleaseinputa,b:");
while(scanf("%lf%lf",&a,&b)&&(b-a)>P&&f(a)*f(b)>=0){
printf("f(a)*f(b)>=0,pleaseinputagain:");
}
printf("Pleaseinputeps:");
scanf("%lf",&P);
do{
c=(a+b)/2.0;
if(fabs(f(c))<P){
break;
}elseif(f(a)*f(c)>0){
a=c;
}else{
b=c;
}
}while(b-a>=P);
printf("x0=%lf ",c);
return0;
}
❻ 单片机C语言程序流程图的示例
你是要示例?
❼ 根据流程图写出C语言程序
#include "stdio.h"
void main()
{
int a;
int L=0;
scanf("%d",&a);
do
{
if(a!=((int)a/2)*2)
{
a=a*3+1;
L++;
}
a=a/2;
L++;
}while(a!=1);
printf("%d",L);
return;
}
❽ C语言流程图
简单用文字给你描述一下吧:
从键盘循环输入a并判断输入成功参数的个数,如果成功输入的参数个数为0则跳出循环
另附scanf函数返回值简介:
scanf("%d,%d", &a, &b);
如果a和b都被成功读入,那么scanf的返回值就是2
如果只有a被成功读入,返回值为1
如果a和b都未被成功读入,返回值为0
如果遇到错误或遇到end of file,返回值为EOF。
❾ c语言流程图怎么画
定义变量--------初始化变量------使用选择或者循环或者顺序结构------调用某一个子函数(可以没有)----------程序结束 以上是最简单的程序流程图画法
倘若你是画某一算法或是某一模块的流程图的话就要把相应的算法或是模块看懂再说分析算法或是模块的具体走法根据此走法就可以画出对应的流程图
如果你是初学者是想根据流程图的画法而去尝试编程的话我建议你就一定要研究好每一个使用到的算法读懂题目再画流程图