自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(38)
  • 收藏
  • 关注

转载 有开始(star)和停止(stop)计数器

计时器 var num=0; var i; function startCount(){ document.getElementById('count').value=num; num=num+1; i=setTimeout("startCount()",1000); } setTimeout("startCount()",1000); func

2015-06-24 15:39:30 725

原创 在from框中显示时间 时:分:秒

定时器 var attime; function clock(){ var time=new Date(); attime=time.getHours()+":"+time.getMinutes()+":"+time.getSeconds() ; document.getElementById("clock").value = att

2015-06-24 14:43:02 491

转载 ComputeLoanUsingInputDialog ( 使用输入对话框)

import javax.swing.JOptionPane;public class ComputeLoanUsingInputDialog { public static void main(String[] args) { // TODO Auto-generated method stub String annualInterestRateString = JOptionPa

2014-07-02 21:13:01 501

原创 求方程ax∧2+bx+c=0的实数根(要求输入实型数a,b,c,并使之满足a!=0且b∧2-4ac>0)

#include "stdio.h"#include "math.h"void main(){ float a, b, c, d, m1, m2; printf ("请输入a, b, c 的值(逗号隔开)\n"); scanf("%f %f %f",&a,&b,&c); //输入a b c 的值 d=b*b-4*a*c; if ( a != 0 ) { if (

2014-06-22 22:39:43 2571

转载 (无聊一java)PrintCalendar

import java.util.Scanner;// 课本144页 public class PrintCalendar { /*Main meehod*/ public static void main(String[] args) { Scanner input = new Scanner(System.in); //Pompt the useu to enter ye

2014-05-27 19:49:46 480

原创 一个菜鸟的自我检讨

老实说,接触java快半年了,真不之自己什么时候额真的会把心真正的头

2014-05-03 22:22:39 534

转载 (每日一java)PrintCalendar

//第五章 143页import java.util.Scanner;public class PrintCalendar { /*main method */ public static void main (String[] args) { Scanner input = new Scanner (System.in); //prompt the user to

2014-04-29 09:29:01 636

转载 (每日一java) ComputerChange 整钱兑零

import java.util.Scanner;public class ComputerChange { public static void main (String[] args) { Scanner input = new Scanner (System.in); //receive the amount System.out.print ( "Enter

2014-04-27 19:39:05 562

转载 (每日一java)ShowCurrentTime 显示系统时间

public class ShowCurrentTime { public static void main (String[] args) { //Obtain the total milliseconds since midnight, Jan 1. 1970 long totalMillisencods = System.currentTimeMillis(); //Ob

2014-04-27 18:05:09 758

转载 (每日一java)FahrenheitToCelsius 29页

import java.util.Scanner;public class FahrenheitToCelsius { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print ("Enter a degree in Fahrenheit:")

2014-04-27 17:39:55 575

转载 (每日一java)ComputeAreaWithConsoleInput

import java.util.Scanner;public class ComputeAreaWithConsoleInput { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a number for rad

2014-04-25 19:43:13 406

转载 (每日一java) Lottery(72页)

import java.util.Scanner;public class Lottery { public static void main(String[] args){ //Generate a lottery int lottery = (int)(Math.random() * 100); //Prompt the user to enter a guess S

2014-04-20 19:17:40 597

转载 (每日一java)ComputeChange

import java.util.Scanner;//课本38页, 2-10;public class ComputeChange { public static void main(String[] args) { Scanner input = new Scanner(System.in); //Receive the amount System.out.print(

2014-04-19 21:20:37 454

转载 (每日一java)WelcomeInMessageDialogBox

import javax.swing.JOptionPane;public class WelcomeInMessageDialogBox { public static void main(String[] args){ //Display Welcome to java!in a message dialog box JOptionPane.showMessageDialog(n

2014-04-18 23:13:20 944

转载 (每日一java)SubtractionQuiz

import java.util.Scanner;public class SubtractionQuiz { public static void main(String[] args) { //1.Generate two random single-digit integers int number1 = (int)(Math.random()*10); int number

2014-04-18 23:11:30 513

转载 c和c指针

#include "stdio.h"#include "stdlib.h"#include "string.h"#define MAX_INPUT 1000#define MAX_COLS 20int read_column_numbers(int columns[], int max);void rearrange( char *output, char const *i

2014-04-16 20:59:09 499

原创 猜生日算法

#include "stdio.h" main(){int set1, set2, set3, set4, sum;char *ch, y;printf ("1\n");printf (" 1 3 5 7\n 9 11 13 15\n17 19 21 23\n25 27 29 31\n\n");printf ("2\n");printf (" 2 3 6

2014-04-15 19:34:35 769

转载 zuoye

#include "stdio.h"#include "malloc.h"#define MaxSize 100typedef char ElemType;typedef struct{ ElemType data[ MaxSize ]; int top; //栈顶指针}SqStack;void InitStack( SqStack *&s) //初始化栈s{ s =

2014-03-27 09:21:40 575

转载 用if 判断是否为闰年

#include "stdio.h"void main(){ int year , leap; scanf ("%d", &year); if ( year % 4 == 0) { if (year % 100 == 0) { if( year % 400 == 0) leap = 1; else leap =

2014-03-11 21:48:49 1443

原创 函数调用的格式求一个学生的n门课程平均分

#include "stdio.h"#define M 100 //定义最多求100个分数int n, i = 0;float a[M], sum = 0, average;float f1(){printf ("输入每门的分数\n");for ( i = 0; i < n; i++){scanf ("%f", &a[i]);sum = sum + a[i];} av

2014-01-05 19:53:21 1918

原创 求n门课程的平均成绩

#include "stdio.h"#define M 100 //定义最多求100个分数 main(){int n, i = 0;float a[M], sum = 0, average;printf ("请问要求多少门成绩:\n");scanf ("%d", &n);printf ("输入每门的分数\n");for ( i = 0; i < n; i++){scanf (

2014-01-05 19:42:52 4049

原创 定义指针函数,输入字符串求其中的字母、数字和其它字符的个数

#include "stdio.h"#define M 1000 // 宏定义字节最大长度int character = 0, num = 0, other = 0;int f(char *x){int i = 0;for ( i = 0; *(x+i) != '\0'; i++){if (( *( x + i ) >= 'a' && *( x + i) = 'A' &&

2014-01-05 19:21:12 2295 2

原创 输入M个学生N门成绩,并求出其每个人的平均分

01.#include "stdio.h" 02.#define M 10 03.#define N 5 04. main() 05.{ 06. int i = 0, j = 0; 07. float a[M][N]; 08. float sum=0, average; 09. 10. printf("please input the studen

2014-01-05 18:33:36 4342

原创 输入16个整数,将变为为一个矩阵输出,然后将转换再次输出

#include "stdio.h"#define M 4#define N 4void main(){ int i, k; int a[M][N] , b[M][N]; for ( i = 0; i < M; i++) for (k = 0; k < N; k++) scanf("%d", &a[i][k]); for ( i = 0; i < M; i

2013-12-19 09:11:06 718

原创 求一个4*4矩阵的转置,并且要输出原来的矩阵

#include "stdio.h"#define M 4#define N 4void main(){ int i, k; int a[M][N] = {{1, 2, 3, 4}, { 5, 6, 7, 8,}, { 9, 10, 11, 12}, {13, 14, 15, 16}}; int b[M][N]; for ( i = 0; i < M; i++)

2013-12-19 09:07:11 7537 3

原创 使用数组,输入N个数,并求其平均值

//以下为一段函数,功能为;输入是个人的成绩,求出平均成绩#include "stdio.h"#define N 10 main(void){ int i; float a[N], average=0, sum = 0; printf ("Please input ten number:\n"); for (i = 0; i < N; i++) { sc

2013-12-19 08:44:29 16037 2

转载 输入10个数字将其按从小到大排序输出

#include "stdio.h"#define N 10void sort( int a[], int n) { int i, j, t; for (i = 0; i < n-1; i++) for (j = 0; j < n - 1 - i; j++ ) if (a[j] > a[j + 1]) { t = a[j];

2013-12-13 20:47:43 3415

原创 输入三个数字,使用指针,是三个数字按从小到达输出

#include "stdio.h"void sort(int *, int *, int *);void main(){int a, b , c, *pointer_1, *pointer_2, *pointer_3;pointer_1 = &a;pointer_2 = &b;pointer_3 = &c;printf ("input 3 numbers:");

2013-12-06 09:13:15 530

原创 用指针解决输入a和b两数字,按先后大小输出a和b

正确代码#include "stdio.h"void main(){ int *p1, *p2, *p, a, b; scanf ( "%d%d", &a, &b); p1=&a; p2=&b; if (a < b) {p = p1; p1 = p2; p2 = p;} printf ("a=%d,b=%d\n",a, b); printf ("max=%

2013-12-05 11:26:55 1165

转载 用foe循环求100到200之间的素数

#include "stdio.h"#include "math.h"void main(){ int m, k, i, n=0; for (m = 101; m <= 200; m = m +2) { k = sqrt (m); for ( i = 2; i <= k; i++) if ( m%i == 0) break; if

2013-12-05 10:30:57 1069

原创 输入一个数组数据,将其逆序输出。

使用函数的定义define #include #define M 10void main(){int a[M],f, i=9;for ( f = 0; f < 10; f++)scanf ("%d", &a[f]);for (i = 9; i >=0; i--)printf ( " %d,",a[i]);}

2013-12-02 19:35:21 3931

转载 将数组a中的n个整数按相反顺序存放并输出

#include void main(){int i, a[10] = {3,4,9,8,11,2,5,6,8,1};void inv(int *x, int n);printf ("The original array:\n");for (i = 0; i < 10; i++)printf ("%5d\n", a[i]);inv(a, 10);printf ("The ar

2013-12-02 18:57:09 2838

转载 连接输入的字符串

//连接字符串#include "stdio.h"int main (void){ void concat (char result [], const char str1[], const char str2[]); const char s1[] = { "Test "}; const char s2[] = { "works."}; char s3[20]; concat

2013-11-29 21:08:55 554

转载 判断一个年份是否是闰年

/*判断某个年份是否是闰年*/#include "stdio.h"int main (void ){int year, rem_4, rem_100, rem_400;printf ("Enter the year to be tested: ");scanf ("%i", &year);rem_4 = year % 4;rem_100 = year % 100;rem_4

2013-11-29 20:46:55 637

转载 找出数组中最小的元素

#include "stdio.h"int minimum (int values[10]){int minValue, i;minValue = values[0];for ( i = 1; i < 10; ++i)if (values[i] < minValue )minValue = values[i];return minValue;}int main (voi

2013-11-29 20:29:14 741

原创 输入10个数,然后将其按从小到大排序出(此代码有错)

#include "stdio.h"minum (int a[]){int i,min;for (i = 1; i <=10;i++)if( a[i]>a[i+1]){min = a[i-1];a[i-1]=a[i];a[i]=min;return a[i];}elsereturn 0;}void main(){int i=0,num[10],m,min;pri

2013-11-29 19:42:27 1386

转载 输出1 到 5 的阶乘值

#include void main(){int fac( int n);int i;for ( i = 1; i <= 5; i++)printf ("%d!=%d\n", i, fac(i));}int fac(int n){static int f = 1;f = f * n;return(f);}

2013-11-29 09:26:00 1158

转载 输入华氏温度和摄氏温度转化表

#include mian(){int fahr, celsius;int lower, upper, step;lower = 0;upper = 300;step = 20;fahr = lower;while ( fahr <= upper) {celsius = 5 * (fahr - 32) /9;printf ("%d\t%d\n", fahr, celsius

2013-11-26 17:35:37 828

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除