![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
程序代码
JoeageL
这个作者很懒,什么都没留下…
展开
-
杭电1003 MAX SUN
Problem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5原创 2013-10-31 17:50:30 · 1035 阅读 · 0 评论 -
第七章第10题
#includeusing namespace std;#define NULL 0struct student{ long num; float score; struct student *next;}; int n;int main(){ student *creat (void);student *del(student*,long);s原创 2013-03-16 12:43:57 · 755 阅读 · 0 评论 -
第八章第6小题
#include using namespace std;class volume{public: void get_dota(); int volume_result();private: int l; int w; int h;};int volume::volume_result(){ return l*w*h;}void vo原创 2013-04-01 19:03:35 · 914 阅读 · 1 评论 -
输出希腊字母的java代码
public class GreekAlphabet{ public static void main(String args[]){ int startPosition=0,endPosition=0; char cStart='α',cEnd='ω'; startPosition=(int)cStart; endPosition=(int)cEnd; Syst原创 2013-04-04 19:05:19 · 2177 阅读 · 0 评论 -
【求助】一个菜鸟java作业,帮忙看一下错在哪儿,题目是判断回文数
import javax.swing.JOptionPance;public class Number{ public static void main(String args[]) { int number=0,d5,d4,d3,d2,d1; String str=JOptionPance.showInputDialog("输入一个1至99999之间的数"); num原创 2013-04-04 19:11:02 · 1193 阅读 · 4 评论 -
优越数问题
/*题目描述给定3个数,如果有两个数大于他们的平均数则称这组数为优越数。(定义纯属虚构)输入输入第一行是一个整数: 表示测试数据的组数。对于每组测试数据,仅一行3个整数。输出对于每组输入数据输出一行,判断它是否为一组优越数,如果是输出“Yes”(输出不包括引号),否则输出“No”*/#include using namespace std;原创 2013-04-08 13:24:29 · 1894 阅读 · 0 评论 -
第八章习题2
#includeusing namespace std;class time{public: void set_time(void) { cin>>hour; cin>>minute; cin>>sec; } void show_time(void) {coutprivate: int hour; int minute;原创 2013-03-25 19:07:23 · 735 阅读 · 0 评论 -
acm2561九九乘法表
/*题目描述 九九乘法表是数学学习的基础,今天我们就来看看乘法表的相关问题。《九九乘法歌诀》,又常称为“小九九”,如下图所示。你的任务是写一个程序,对于给定的一个正整数 n ,输出“九九乘法表”的前 n 行。 输入 输入包含多组测试数据,以 EOF 结束。每组测试数据只包含一个正整数 n (0 < n < 10)。 输出 对于每组测试数据,输出上图原创 2013-04-08 15:11:38 · 1355 阅读 · 0 评论 -
第八张习题1
#includeusing namespace std;class time{public: void set_time(void); void show_time(void); int hour; int minuter; int sec;};time t1; void set_time(void); void show_time(voi原创 2013-03-25 19:06:43 · 562 阅读 · 0 评论 -
第七章第3小题
#include #include using namespace std;struct student{ int num; string name; int score[3];};int main(){ void print(student s[5]); student s[5]; s[0].num=1001; s[0].name="赵大"原创 2013-03-16 12:41:37 · 617 阅读 · 0 评论 -
第七章第2小题
#include using namespace std;struct date{ int year; int month; int days;};int main(){ int days(date); date d1; cin>>d1.year; cin>>d1.month; cin>>d1.days; cout<<"您输入的时间是"<原创 2013-03-16 12:40:14 · 642 阅读 · 0 评论 -
【求助】大神专家们都来看看,我忙活了一整个下午,运用基础C++写的小游戏为啥还有错误;
#include #include #include #include using namespace std;//全局变量const char X='X';const char O='O';const char EMPTY=' ';const char TIE='T';const char NO_ONE='N';//函数原型void instruc原创 2012-12-16 18:59:47 · 795 阅读 · 0 评论 -
结构体变量数组示例
#include #include using namespace std;struct person{ char name[20]; int cout;}leader[3]={"赵",0,"钱",0,"孙",0};int main(){ int i,j; string leader_name; for(i=0;i { cin>>leade原创 2013-01-28 23:15:44 · 514 阅读 · 0 评论 -
指针链表
#include using namespace std;struct student{int num;float score;struct student*next;};int main(){ student a,b,c,*head,*p; a.num=31001;a.score=89.5; b.num=31003;b.score=90; c.nu原创 2013-01-28 23:16:36 · 385 阅读 · 0 评论 -
C++windows代码
/*------------------------------------------------------------------------ HELLOWIN.C -- Displays "Hello, Windows 98!" in client area (c) Charles Petzold, 1998 ----------------------------------转载 2013-01-28 23:08:18 · 545 阅读 · 0 评论 -
结构体指针作实参
#include #include using namespace std;struct student{ int num; string name; float score[3];};int main(){ void print(student*); student stu; stu.num=110; stu.name="陆岩"; st原创 2013-01-30 22:47:02 · 642 阅读 · 0 评论 -
new&delete示例运用
#include #include using namespace std;struct student{ int num; string name; string sex;};int main(){ student*p; p=new student; p->num=110; p->name="陆岩"; p->sex="男"; cou原创 2013-01-30 22:47:57 · 506 阅读 · 0 评论 -
结构体变量作函参
#include #include using namespace std;struct student{int num;string name;float score[3];};int main(){void print(student);student stu;stu.num=110;stu.name="陆岩";stu.score[0原创 2013-01-30 22:46:15 · 603 阅读 · 0 评论 -
第七章第4小题
#include #include using namespace std;struct student{ int num; string name; int score[3];};int main(){ void input(student s[5]); student s[5]; input (s); return 0;} v原创 2013-03-16 12:42:50 · 626 阅读 · 0 评论 -
第八章习题4
#include #include using namespace std;class student{public: void set_value() {cin>>num>>name>>sex;} void display() { cout cout cout }private: int num; string name;原创 2013-03-25 19:08:44 · 1026 阅读 · 1 评论 -
第八章习题3
#includeusing namespace std;class time{public: void set_time(void); void show_time(void);private: int hour; int minuter; int sec;};time t1; void set_time(void); void sho原创 2013-03-25 19:08:01 · 620 阅读 · 0 评论 -
运算符重载
/*Output两个虚数相加的结果,格式(a,bi)形式Sample Input2.5 3.1 -4.5 0.3Sample Output(-2,3.4i)*/#includeusing namespace std;class Complex{public: Complex() { real=0;imag=0; } Comple原创 2013-04-22 18:07:54 · 769 阅读 · 0 评论 -
第九章课后9
#includeusing namespace std;class store{public: store(int n,int q,double p) { num=n; quantity=q; price=p; } void total(); static void display(); static float average();p原创 2013-04-15 19:18:30 · 672 阅读 · 0 评论 -
OJ平台下的输出图形,可惜平台通不过
/*Description从键盘输入一个整数n(1≤n≤9),打印出指定的数字图形。Input正整数n(1≤n≤9)。Output指定数字图形。Sample Input5Sample Output 1 121 12321 1234321123454321 1234321 12321 121原创 2013-04-15 18:43:13 · 644 阅读 · 0 评论 -
java水仙花数
public class Narcissus{ public static void main(String[] args) { int i,j,k,n=100,m=1; while(n<1000) { i=n/100; j=(n-i*100)/10; k=n%10; if(Math.pow(i,3)+Math.pow(j,3)+M原创 2013-04-25 18:13:42 · 820 阅读 · 0 评论 -
c++计算圆周率
/*Description输入n值,并利用格里高里公式计算并输出圆周率: Input输入公式中的n值。 Output输出圆周率,保留5位小数。 Sample Input1Sample Output2.66667*/#include #include using namespace std;int main(){ int n;原创 2013-05-06 18:56:52 · 14285 阅读 · 0 评论 -
打印金字塔代码
Description输入n值,打印下列形状的金字塔,其中n代表金字塔的层数。Input输入只有一个正整数n。Output打印金字塔图形,其中每个数字之间有一个空格。#include #include using namespace std;int main(){ int n,i,j; cin>>n; for(i=1;i<原创 2013-05-06 19:18:18 · 2199 阅读 · 0 评论 -
java代码终于过百行了
/*求三角形,圆。梯形周长及面积的代码*/class Trangle{ double sideA,sideB,sideC,area,length; boolean boo; public Trangle(double a,double b,double c) { sideA=a; sideB=b; sideC=c; if(a+b>c&&a+c原创 2013-05-09 18:52:15 · 1084 阅读 · 0 评论 -
java练习
class A{ float a; static float b; void setA(float a) { this.a=a; } void setB(float b) { this.b=b; } float getA() { return a; } float getB() { return b; } vo原创 2013-05-09 19:01:14 · 973 阅读 · 1 评论 -
多位数处理
/*Description给出一个不多于5位的整数,要求 1、求出它是几位数 2、分别输出每一位数字 3、按逆序输出各位数字,例如原数为321,应输出123Input一个不大于5位的数字Output三行第一行 位数第二行 用空格分开的每个数字,注意最后一个数字后没有空格第三行 按逆序输出这个数Sample Input12345Sample Outpu原创 2013-04-22 18:06:32 · 1241 阅读 · 0 评论 -
长方体类
/*Description编写基于对象的程序,求长方柱(Bulk)的体积。数据成员包括长(length)、宽(width)、高(heigth)、体积,要求用成员函数实现下面的功能:(1)由键盘输入长方柱的长、宽、高;(2)计算长方柱的体积(volume)和表面积(areas);(3)输出这长方柱的体积和表面积。Input长方柱的长、宽、高Output长方柱的体积原创 2013-04-22 19:16:43 · 1141 阅读 · 0 评论 -
从大到小输出a、b、c
/*题目描述从键盘输入三个整数a、b、c,要求将输出的数据按从大到小排序后输出。输入从键盘上输入三个整数a、b、c,每个整数之间用空格分开。输出从大到小顺序输出a、b、c的值。*/#include using namespace std;int main(){ int a,b,c,m; cin>>a>>b>>c; if(b<c) { m原创 2013-04-10 14:04:25 · 1744 阅读 · 0 评论 -
OJ平台太难受了,运行正确就是通不过,有大神的话看看咋改能通过
/*题目描述春天是鲜花的季节,水仙花就是其中最迷人的代表,数学上有个水仙花数,是这样定义的: “水仙花数”是指一个三位数,它的各位数字的立方和等于其本身,比如:153=13+53+33。现在要求输出所有在m和n范围内的水仙花数。输入输入数据有多组,每组占一行,包括两个整数m和n(100<=m<=n<=999)。输出对于每个测试实例,要求输出所有在给定范围内的水仙花数,就原创 2013-04-10 14:38:00 · 1826 阅读 · 0 评论 -
简单字符串比较
/*题目描述请使用字符串比较函数,比较两个字符串的大小,并按要求输出比较后的结果。字符串最长不超过15个字符。输入两个字符串str1和str2,如果第一个字符串与第二个字符串相等,输出str1=str2,如果第一个字符串大于第二个字符串,输出str1>str2,如果第一个字符串小于第二个字符串,输出str1 < str2。输入第1行为第一个字符串。 第2行为第二个字符串。输原创 2013-04-10 14:49:33 · 1674 阅读 · 0 评论 -
【求助】还是OJ,运行挺好,但就是不给通过,ACM大神指导下咋改改啊
/*题目描述 输入一个不超过101个英文字符的一句话,你的任务是把这句话中所有单词的首字母变为大写。输入输入包含多组测试数据,每组数据只有一行为一个字符串,字符串的长度不超过101。输出对于每组测试数据,输出转换后的英文句子。示例输入i need you i love you and i miss you示例输出I Need You I Love You原创 2013-04-10 14:53:40 · 1200 阅读 · 7 评论 -
【再次求助】亲和数,在自己机子上能运行,在OJ平台上不能通过
/*题目描述如果a的因子和等于b,b的因子和等于a,且a≠b,则称a,b为亲和数对。比如220的所有真约数(即不是自身的约数)之和为:1+2+4+5+10+11+20+22+44+55+110=284。284的所有真约数和为:1+2+4+71+142=220。你的任务就编写一个程序,判断给定的两个数是否是亲和数。输入输入数据第一行包含一个数M,接下有M行,每行一个实原创 2013-04-10 15:34:57 · 967 阅读 · 1 评论 -
猜数字java代码【本人菜鸟】
import javax.swing.JOptionPane;public class GuessNumber{ public static void main(String args[]) { System.out.println("给你一个1到100之间的整数,请猜测这个数"); int realNumber=(int)(Math.random()*100)+1;原创 2013-04-11 18:21:44 · 1050 阅读 · 0 评论 -
java入门级代码
public class MySeason { public static void main(String args[]) { int month=7; char season; if(month==12||month==1||month==2) season='冬'; else if(month==3||month==4||month==5) sea原创 2013-04-11 18:59:27 · 767 阅读 · 0 评论 -
一个java小作业
import java.io.*;import java.lang.*;public class MyScore { public static void main(String args[])throws IOException { double score=59; String str,s="成绩为:"; BufferedReader br=new Buffer原创 2013-04-11 18:47:59 · 1003 阅读 · 0 评论 -
指针作业1
#include using namespace std;int main(){ void exchange(int*p1,int*p2); int a,b; int*p1,*p2; cin>>a>>b; p1=&a; p2=&b; exchange(p1,p2); cout return 0;}void exchange(int*p1,in原创 2012-12-24 16:04:58 · 478 阅读 · 0 评论