❶ 誰那有流程圖的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語言流程圖怎麼畫
定義變數--------初始化變數------使用選擇或者循環或者順序結構------調用某一個子函數(可以沒有)----------程序結束 以上是最簡單的程序流程圖畫法
倘若你是畫某一演算法或是某一模塊的流程圖的話就要把相應的演算法或是模塊看懂再說分析演算法或是模塊的具體走法根據此走法就可以畫出對應的流程圖
如果你是初學者是想根據流程圖的畫法而去嘗試編程的話我建議你就一定要研究好每一個使用到的演算法讀懂題目再畫流程圖