摘要:
package lyt;import java.util.*;public class Lyt6 {public static void main(String[] args) {// TODO Auto-generated method stubScanner input=new Scanner(System.in); int []arr=new int[100]; int max=0,count=0,m=0; System.out.print("请输入一串字符串:"); for(int i=0;i<100;i++) { arr[i]=input.nextInt() 阅读全文
摘要:
C/C++中int/long/float/double数值类型与字符串互相转换[总结]memcpy方法可以实现将int等保存到字符类型的数组中。示例:long long_data=-9828;unsigned char data[4];memcpy(data,&t,4); //将long类型的数据用4个char保存。long my_long_data=0;memcpy(&tt,data,4);//从4个char中还原出long类型数据。一、int/long/float/double转字符串方法1:itoa, ltoa(a表示array数组的意思)头文件:stdlib.h示例:i 阅读全文
摘要:
package lyt;import javax.swing.*;public class Lyt5 {public static void main(String[] args) {// TODO Auto-generated method stubString year=JOptionPane.showInputDialog(null,"请输入年份:","梁燕婷",JOptionPane.QUESTION_MESSAGE);String weekend=JOptionPane.showInputDialog(null,"请输入改年第一天的星 阅读全文
摘要:
package lyt;import javax.swing.JOptionPane;public class Lyt4 {public static void main(String[] args) {// TODO Auto-generated method stubdouble sum=0,s=-1;for(long i=1;i<99999999;i++){s=-s;sum=sum+1.0/(2*i-1)*s;}JOptionPane.showMessageDialog(null, "PI = " + 4*sum,"ÁºÑ 阅读全文
摘要:
package lyt;public class Lyt3 {public static void main(String[] args) {// TODO Auto-generated method stubfor(int j=0,i=8;j{for(int m=8-j;m>0;--m) System.out.print(" ");//System.out.print(" 1");for(int n=0;n<=j;n++){System.out.printf("%4s",(int)(Math.pow(2, n)));}f 阅读全文
摘要:
package lyt;import javax.swing.JOptionPane;public class Lyt1 {public static void main(String[] args) {// TODO Auto-generated method stubdouble fee=10000,sum=0,sum1=0;for(int i=0;i<14;i++){if(i<14&&i>9){ sum=sum+fee; fee=fee+fee*5.0/100;}if(i<10){ fee=fee+fee*5.0/100; sum1=fee;}}J 阅读全文
摘要:
#include#include#include#includeusing namespace std;ifstream infile1;ifstream infile2;ifstream infile3;class qclx{string checi; string start,end;string type;string distance;string statime,endtime;double price;int zws;public:void input();void output();friend void change1();};void qclx::input(){infile 阅读全文
摘要:
#include#includeusingnamespacestd;intGreat();intn1=0,n2=0;intmain(){charc='Y';while(c=='Y'){Great();cout<<"是否想继续进行游戏???YorN:";cin>>c;system("cls");}cout<<"游戏者赢得次数:"<<n1<<endl;cout<<"游戏者失败的次数:"<<n2<&l 阅读全文
摘要:
#include#include#include#includeusing namespace std;ifstream infile1;ifstream infile2;ifstream infile3;class qclx{string checi; string start,end;string type;string distance;string statime,endtime;double price;int zws;public:void input();void output();friend void change1();};void qclx::input(){infile 阅读全文
摘要:
#includeusing namespace std;int main (){int a[9999],i,b=0,n,c,z=0;while(cin>>n){ b=0;c=n; for(i=0;ia[i]=i+1; while(c--) { z=0; for(i=0;i if(a[i]!=0){ b++;z++; if(b==3) {a[i]=0; b=0; }} if(z==1) break; }for(i=0;iif(a[i]!=0)cout<<a[i]<<endl;}return 0;} 阅读全文