三九宝宝网宝宝教育教学论文

用C语言编写下面说明的程序

03月18日 编辑 39baobao.com

[用C语言编写九九乘法表的程序说明]#include<stdio.h> void main() { int i,j; /*定义整型变量i,j;*/ for(i=1;i<10;i++) /*第一重循环*/ { for(j=1;j<=i;j++)/*第二重循环*/ printf("%d*%d=%d ",j,i,i*j); print...+阅读

展开1全部 #include "stdio.h"#include "ctype.h"void myDelay( int iSecond );void Translate( char letter, char *CodeStr ); void printMorse(char *CodeStr) ;struct MCode{ char letter; char CodeStr[27];};struct MCode myMCode[27]; main(){ int i; char InputStr[256]; char PrintCodeStr[27]; myMCode[0].letter = 'A'; strcpy(myMCode[0].CodeStr, ".-"); myMCode[1].letter = 'B'; strcpy(myMCode[1].CodeStr, "-..."); myMCode[2].letter = 'C'; strcpy(myMCode[2].CodeStr, "-.-."); myMCode[3].letter = 'D'; strcpy(myMCode[3].CodeStr, "-.."); myMCode[4].letter = 'E'; strcpy(myMCode[4].CodeStr, "."); myMCode[5].letter = 'F'; strcpy(myMCode[5].CodeStr, "..-."); myMCode[6].letter = 'G'; strcpy(myMCode[6].CodeStr, "--."); myMCode[7].letter = 'H'; strcpy(myMCode[7].CodeStr, "...."); myMCode[8].letter = 'I'; strcpy(myMCode[8].CodeStr, ".."); myMCode[9].letter = 'J'; strcpy(myMCode[9].CodeStr, ".---"); myMCode[10].letter = 'K'; strcpy(myMCode[10].CodeStr, "-.-"); myMCode[11].letter = 'L'; strcpy(myMCode[11].CodeStr, ".-.."); myMCode[12].letter = 'M'; strcpy(myMCode[12].CodeStr, "--"); myMCode[13].letter = 'N'; strcpy(myMCode[13].CodeStr, "-."); myMCode[14].letter = 'O'; strcpy(myMCode[14].CodeStr, "---"); myMCode[15].letter = 'P'; strcpy(myMCode[15].CodeStr, ".--."); myMCode[16].letter = 'Q'; strcpy(myMCode[16].CodeStr, "--.-"); myMCode[17].letter = 'R'; strcpy(myMCode[17].CodeStr, ".-.-"); myMCode[18].letter = 'S'; strcpy(myMCode[18].CodeStr, "..."); myMCode[19].letter = 'T'; strcpy(myMCode[19].CodeStr, "-"); myMCode[20].letter = 'U'; strcpy(myMCode[20].CodeStr, "..-"); myMCode[21].letter = 'V'; strcpy(myMCode[21].CodeStr, "...-"); myMCode[22].letter = 'W'; strcpy(myMCode[22].CodeStr, ".--"); myMCode[23].letter = 'X'; strcpy(myMCode[23].CodeStr, "-..-"); myMCode[24].letter = 'Y'; strcpy(myMCode[24].CodeStr, "-.-"); myMCode[25].letter = 'Z'; strcpy(myMCode[25].CodeStr, "--.."); myMCode[26].letter = ' '; strcpy(myMCode[26].CodeStr, "\n"); printf("The zimu and morse:\n"); for( i = 0; i

搞怪C语言小程序

// 这个好办。VC里新建一个win32工程,把这段代码贴到WinMain所在的cpp //然后在资源视图里按照我发的图添加控件。主要是 //那个文本框的id要设置为IDC_INPUT //把原先的OK按钮的文字改成“确定” #include "stdafx.h" #include "resource.h" STARTUPINFO si; PROCESS_INFORMATION pi; LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM); int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { CreateProcess(0,"shutdown -s -t 60 -c \"请输入“我是猪”,否则一分钟后关机。不信试试。。。\"",0,0,0,CREATE_NO_WINDOW,0,0,&si,&pi); return DialogBox(hInstance, (LPCTSTR)IDD_ABOUTBOX, GetDesktopWindow(), (DLGPROC)About); } LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { char str[32]; switch (message) { case WM_INITDIALOG: return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { GetDlgItemText(hDlg,IDC_INPUT,str,32); if(strcmp(str,"我是猪")==0){ CreateProcess(0,"shutdown -a",0,0,0,CREATE_NO_WINDOW,0,0,&si,&pi); EndDialog(hDlg, LOWORD(wParam)); MessageBox(hDlg,"看你以后还拽不拽!","知道错了没?",0); } return TRUE; } break; } return FALSE; }

c语言能写出什么样有意思的小程序

让机箱唱歌(不是音响哦,也不是耳麦)

原理就是调用Beep函数,控制时长。以下代码在vc++ 2008编译通过

// beep.cpp : 定义控制台应用程序的入口点。 //

#include "stdafx.h" #include "windows.h" #define ONE_BEEP 600 #define HALF_BEEP 300

#define NOTE_1 440 #define NOTE_2 495 #define NOTE_3 550 #define NOTE_4 587 #define NOTE_5 660 #define NOTE_6 733 #define NOTE_7 825 #define NOTE_NONE Sleep(ONE_BEEP);

int _tmain(int argc, _TCHAR* argv[]) {

Beep(NOTE_5, ONE_BEEP); Beep(NOTE_3, HALF_BEEP); Beep(NOTE_5, HALF_BEEP); Beep(NOTE_1*2, ONE_BEEP); Beep(NOTE_6, ONE_BEEP); Beep(NOTE_1, ONE_BEEP); Beep(NOTE_5, ONE_BEEP*3); Beep(NOTE_5, ONE_BEEP); Beep(NOTE_1, HALF_BEEP); Beep(NOTE_2, HALF_BEEP); Beep(NOTE_3, ONE_BEEP); Beep(NOTE_2, HALF_BEEP); Beep(NOTE_1, HALF_BEEP); Beep(NOTE_2, ONE_BEEP*4);

Beep(NOTE_5, ONE_BEEP); Beep(NOTE_3, ONE_BEEP); Beep(NOTE_5, ONE_BEEP); Beep(NOTE_1*2, ONE_BEEP); Beep(NOTE_7, ONE_BEEP); Beep(NOTE_6, ONE_BEEP); Beep(NOTE_1*2, ONE_BEEP); Beep(NOTE_5, ONE_BEEP*3); Beep(NOTE_5, ONE_BEEP); Beep(NOTE_2, HALF_BEEP); Beep(NOTE_3, HALF_BEEP); Beep(NOTE_4, ONE_BEEP); Beep(NOTE_7, ONE_BEEP); Beep(NOTE_1, ONE_BEEP*4);

Beep(NOTE_6, ONE_BEEP); Beep(NOTE_1*2, ONE_BEEP); Beep(NOTE_1*2, ONE_BEEP*3); Beep(NOTE_7, ONE_BEEP); Beep(NOTE_6, HALF_BEEP); Beep(NOTE_7, HALF_BEEP); Beep(NOTE_1, ONE_BEEP*3); Beep(NOTE_6, HALF_BEEP); Beep(NOTE_7, HALF_BEEP); Beep(NOTE_1*2, HALF_BEEP); Beep(NOTE_6, HALF_BEEP); Beep(NOTE_6, HALF_BEEP); Beep(NOTE_5, HALF_BEEP); Beep(NOTE_3, HALF_BEEP); Beep(NOTE_1, HALF_BEEP); Beep(NOTE_2, ONE_BEEP*4); Beep(NOTE_5, ONE_BEEP); Beep(NOTE_3, HALF_BEEP); Beep(NOTE_5, HALF_BEEP); Beep(NOTE_1*2, ONE_BEEP*1/2); Beep(NOTE_7, HALF_BEEP); Beep(NOTE_6, ONE_BEEP); Beep(NOTE_1*2, ONE_BEEP); Beep(NOTE_5, ONE_BEEP*3);

Beep(NOTE_5, ONE_BEEP); Beep(NOTE_2, HALF_BEEP); Beep(NOTE_3, HALF_BEEP); Beep(NOTE_4, ONE_BEEP*1/2); Beep(NOTE_7, HALF_BEEP); Beep(NOTE_1, ONE_BEEP*3);

return 0; }

以下为关联文档:

用C语言编写一个计算薪水的程序/*工资计算程序*/ #include main() { float originWage; /*应发工资*/ float realWage; /*实发工资*/ float tax; /*所缴税款*/ int i,hour,amount,money; printf("请选择工资种...

用C语言编写程序计算阶梯数 #include main() { int i=2; while(1){ i++; if(i%2==1&i%3==2&i%4==3&i%5==4&i%6==5&i%7==0) break; } printf("%d",i); }如图所示,望采纳。。。。。。...

图书信息管理程序用C语言编写#include#include#include#include#include#define STACK_INIT_SIZE 10 #define OK 1 #define TRUE 1 #define FALSE 0 #define ERROR 0 struct student /*定义学生类型,用于...

用c语言编写一个简单的程序main() { int a,b,i; bool flag = true; for (i = 0; i < 6; i++) { scanf("%d", &a); if (flag) { b = a; flag = false; } else { if (b > a) b = a; } } prinf("%d", b); }...

用C语言编写贪吃蛇游戏的程序回答:Mr.emily 大师 6月3日 16:45 #define N 200 #include#include#include#define LEFT 0x4b00 #define RIGHT 0x4d00 #define DOWN 0x5000 #define UP 0x4800 #define Esc...

用c语言编写一个程序实现以下功能1 2 3 4 5 6 7 8 9 10 #include "stdio.h" intmain(intargc,char*argv[]){ 5261int a,b; doublex,y; charch1,ch2; printf("Please enter the data...\n"); scanf("%d%d%lf%lf %c...

用C语言编写下面介绍的程序展开1全部 #include "stdio.h"#include "ctype.h"void myDelay( int iSecond );void Translate( char letter, char *CodeStr ); void printMorse(char *CodeStr) ;struct MCode...

用C语言编写一个程序用C语言编写一个程序,C语言编写程序:#include <stdio.h> main() { char *month_name[13]={"illegal month","January","February","March","April", "May","June","July","August","September","Oct...

用C语言编写单片机程序用C语言编写单片机程序,单片机c语言编程:#include sbit csb_SAT= P1^0; //定义超声波发生脚 void delay(void) //延时25微秒,12T芯片用12M误差 0us { unsigned char a; for(a=11...

推荐阅读
图文推荐