1.java å½åå¦ç
2.插入版权符号©所对应的源代码是
3.c++ 最长最短单词
java å½åå¦ç
public class School {
private String name;
private double line;
public School(){ };
public School(String name,double line) {
super();
this.name=name;
this.line = line;
}
public double getLine() {
return line;
}
public void setLine(double line) {
this.line = line;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public class Student {
private String id;
private String name;
private double total;
private double sports;
public Student(){
}
public Student(String id, String name, double total, double sports) {
super();
this.id = id;
this.name = name;
this.total = total;
this.sports = sports;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getTotal() {
return total;
}
public void setTotal(double total) {
this.total = total;
}
public double getSports() {
return sports;
}
public void setSports(double sports) {
this.sports = sports;
}
}
public class Pass {
public void status(School s,Student stu){
if(stu.getTotal()>=s.getLine()||(stu.getSports()>=||stu.getTotal()>=)){
System.out.println("å¦å·ä¸ºï¼"+stu.getId()+" "+"å§å为ï¼"+stu.getName()+"çåå¦è¢«"+s.getName()+"å½åï¼è¯¥å¦æ ¡çå½ååæ°çº¿ä¸ºï¼"+s.getLine());
}else{
System.out.println("å¦å·ä¸ºï¼"+stu.getId()+" "+"å§å为ï¼"+stu.getName()+"çåå¦æ²¡æ被"+s.getName()+"å½åï¼è¯¥å¦æ ¡çå½ååæ°çº¿ä¸ºï¼"+s.getLine());
}
}
public static void main(String[] args){
School school1=new School("æ¸ å大å¦",);
School school2=new School("å京大å¦",);
Student stu1=new Student("","å°çº¢",,);
Student stu2=new Student("","å°æ",,);
Student stu3=new Student("","å¼ ä¸",,);
Student stu4=new Student("","æå",,);
Pass p=new Pass();
p.status(school1, stu1);
p.status(school1, stu2);
p.status(school2, stu3);
p.status(school2, stu4);
}
}
è¿è¡ç»æ为ï¼
å¦å·ä¸ºï¼ å§å为ï¼å°çº¢çåå¦è¢«æ¸ å大å¦å½åï¼è¯¥å¦æ ¡çå½ååæ°çº¿ä¸ºï¼.0
å¦å·ä¸ºï¼ å§å为ï¼å°æçåå¦è¢«æ¸ å大å¦å½åï¼è¯¥å¦æ ¡çå½ååæ°çº¿ä¸ºï¼.0
å¦å·ä¸ºï¼ å§å为ï¼å¼ ä¸çåå¦è¢«å京大å¦å½åï¼è¯¥å¦æ ¡çå½ååæ°çº¿ä¸ºï¼.0
å¦å·ä¸ºï¼ å§å为ï¼æåçåå¦è¢«å京大å¦å½åï¼è¯¥å¦æ ¡çå½ååæ°çº¿ä¸ºï¼.0
插入版权符号©所对应的源代码是
#include <stdio.h>
#define MAXLINE /* maximum input line length */
int getline(char line[], int maxline);
void copy(char to[], char from[]);
/* print the longest input line */
main()
{
int len; /* current line length */
int max; /* maximum length seen so far */
char line[MAXLINE]; /* current input line */
char longest[MAXLINE]; /* longest line saved here */
c++ 最长最短单词
修改后的源代码:#include<iostream>using namespace std ;
char line[] ;
int main()
{
cin.getline(line,) ;
int cur = 0, pos = 0, maxlen = 0, minlen = ;
int minpos, maxpos ;
int len = strlen(line) ;
for (int i = 0; i < len; i++) {
if (isalpha(line[i])) cur ++ ;
else {
if (cur > maxlen) {
maxlen = cur; maxpos = pos ;
}
if (cur < minlen) {
minlen = cur; minpos = pos ;
}
cur = 0; pos = i + 1 ;
}
}
if (cur > maxlen) {
maxlen = cur; maxpos = pos ;
}
if (cur < minlen) {
minlen = cur; minpos = pos ;
}
if (minlen == maxlen) {
for (int i = minpos; isalpha(line[i]); i ++)
cout << line[i] ;
} else {
for (int i = maxpos; isalpha(line[i]); i ++)
cout << line[i] ;
cout << endl ;
for (int i = minpos; isalpha(line[i]); i ++)
cout << line[i] ;
cout << endl ;
}
return 0;
}
isalpha()为判断该字符是否为大写或小写字母,返回bool值,1或0
在循环中,鬼魅炼狱源码minnum/maxnum记录的最长/最短单词的位置是这个单词的末尾,输出应找到单词开始的上海直播系统源码位置再输出,这个写反了。澳门开奖源码
循环结束时,可能最后还有一个单词,应该也统计进答案中。
望采纳!