전자 공학도를 위한 c 언어 5장 프로그램
본 자료는 4페이지 의 미리보기를 제공합니다. 이미지를 클릭하여 주세요.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
해당 자료는 4페이지 까지만 미리보기를 제공합니다.
4페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

전자 공학도를 위한 c 언어 5장 프로그램에 대한 보고서 자료입니다.

목차

▤ 프로그램 5.1

▤ 프로그램 5.2

▤ 프로그램 5.3

▤ 프로그램 5.4

▤ 프로그램 5.5

▤ 프로그램 5.6

▤ 프로그램 5.7

▤ 프로그램 5.8

▤ 프로그램 5.9

▤ 프로그램 5.10

▤ 프로그램 5.11

▤ 프로그램 5.12

▤ 프로그램 5.13

▤ 프로그램 5.14

▤ 프로그램 5.15

본문내용

프로그램 5.10
#include
int main(void)
{
enum {BLACK,BROWN,RED,ORANGE,YELLOW,
GREEN,BLUE,VIOLET,GREY,WHITE} colours;
printf(\"Enter value >>\");
scanf(\"%d\",&colours);
printf(\"Resistor colour band is \");
switch (colours)
{
case BLACK: printf(\"BLACK\"); break;
case BROWN: printf(\"BROWN\"); break;
case RED: printf(\"RED\"); break;
case ORANGE: printf(\"ORANGE\"); break;
case YELLOW: printf(\"YELLOW\"); break;
case GREEN: printf(\"GREEN\"); break;
case BLUE: printf(\"BLUE\"); break;
case VIOLET: printf(\"VIOLET\"); break;
case GREY: printf(\"GREY\"); break;
case WHITE: printf(\"WHITE\"); break;
default: printf(\"NO COLOUR\"); break;
}
return(0);
}
▤ 프로그램 5.11
/*Program to determine TTL ICs for a given function*/
#include
int main(void)
{
enum{AND=1,OR,NAND,NOR,NOT} gate_type;
puts(\"Enter logic gate required\");
puts(\"1 - 2-input AND gate\");
puts(\"2 - 2-input OR gate\");
puts(\"3 - 2-input NAND gate\");
puts(\"4 - 2-input NOR gate\");
puts(\"5 - 2-input NOT gate\");
puts(\"6 - exit program\");
scanf(\"%d\",&gate_type);
printf(\"TTL gate(s) available is (are)\");
switch (gate_type)
{
case AND: puts(\"7408\"); break;
case OR: puts(\"7432\"); break;
case NAND: puts(\"7400,7401,7403,7437,7438\");break;
case NOR: puts(\"7402,7428,7433\"); break;
case NOT: puts(\"7404,7405,7505,7416\");break;
default: puts(\"Invalid option\");
}
return(0);
}
▤ 프로그램 5.12
/*Program to determine the resistance */
/* of a cylindrical conductor */
#include
#include
#include
#include
/* Define resisitivities */
#define RHO_COPPER17e-9
#define RHO_AL25.4e-9
#define RHO_SILVER16e-9
#define RHO_MAGANESE1400e-9
#definePI3.14
intmain(void)
{
float radius,length,area,rho,resistance;
char ch;
puts(\"Type of conductor >>\");
puts(\"(c)opper\");
puts(\"(a)luminum\");
puts(\"(s)ilver\");
puts(\"(m)aganese\");
/* get conductor type*/
ch=getchar();
printf(\"Enter radius and length of conductor >>\");
scanf(\"%f %f\",&radius,&length);
/* area of conductor*/
area=PI*(radius*radius); /* convert to lowercase and determine resistivity*/
switch (tolower(ch))
{
case \'c\': rho=RHO_COPPER; break;
case \'a\': rho=RHO_AL; break;
case \'s\': rho=RHO_SILVER; break;
case \'m\': rho=RHO_MAGANESE;break;
default: puts(\"Invalid option\");exit(0); break;
}
resistance= rho*length/area;
printf(\"Resistance of conductor is %.3e ohm\",resistance);
return(0);
}
▤ 프로그램 5.13
#include
int main(void)
{
int i;
puts(\"Enter value of i\");
scanf(\"%d\",i);
if (i = 5) puts(\"i is equal to five\");
return(0);
}
▤ 프로그램 5.14
/* Simple calculator */
#include
int main(void)
{
int a=5,b=3;
char ch;
puts(\"Enter operator (+,-,* or /);
ch = getchar();
switch (ch)
case \'+\': c=a+b;
case \'-\': c=a-b;
case \'*\': c=a*b;
case \'/\': c=a/b;
print(\" %d %c %d = %d\",a,ch,b,c);
return(0);
}
▤ 프로그램 5.15
#include
int main(void)
{
int a;
puts(\"Enter a number);
scanf(\"%d\",&a);
switch (a)
{
case 1: puts(\"1 entered\");
case 2: puts(\"2 entered\");
case 3: puts(\"3 entered\");
case 4: puts(\"4 entered\");
default: puts(\"Not 1,2,3 or 4\");
}
return(0);
}
  • 가격2,000
  • 페이지수12페이지
  • 등록일2006.04.17
  • 저작시기2006.4
  • 파일형식한글(hwp)
  • 자료번호#344642
본 자료는 최근 2주간 다운받은 회원이 없습니다.
다운로드 장바구니