1.24ç¹è®¡ç®å¨
2.java中byte a =(byte)1000为什么输出成-24求大
24ç¹è®¡ç®å¨
ä½ å¥½
ä¸é¢çå°ç¨åºæä¸äºç¬¨ï¼è¯æ³å¾ç®åï¼
å®æ æ³å辨ä¸äºéå¤çæ åµ
ä½ç»æè¿æ¯åºæ¬æ£ç¡®ç
#include<iostream>
using namespace std;
int main(){
int i1,i2,i3,i4,v,n1,n2;
int num=0;
int a,b;
double t1,t2,t3,t4,choice[4],s1[4],s2[4][4],s3[2],t;
for(;;){
cout<<"########################## äºååç¹ ###################################\nåæ æ示ï¼A=1,J=,Q=,K=\n";
cout<<"请ç»åºä½ æ½å°ç第ä¸çï¼";
cin>>choice[0];
cout<<"请ç»åºä½ æ½å°ç第äºçï¼";
cin>>choice[1];
cout<<"请ç»åºä½ æ½å°ç第ä¸çï¼";
cin>>choice[2];
cout<<"请ç»åºä½ æ½å°ç第åçï¼";
cin>>choice[3];
cout<<"########################## THINKING ###################################\n";
for(b=0;b<=2;b++)
for(a=3;a>=1+b;a--)if(choice[a]<choice[a-1]){
t=choice[a-1];
choice[a-1]=choice[a];
choice[a]=t;}
for(int j=0;j<4;j++)cout<<j+1<<". "<<choice[j]<<" ";
cout<<"\n";
for(i1=0;i1<4;i1++){
t1=choice[i1];
for(i2=0;i2<4;i2++){ if((i1-1)!=0 && t1==choice[i1-1])break;
if(i2!=i1){
t2=choice[i2];
s1[0]=t1+t2;
s1[1]=t1-t2;
s1[2]=t1*t2;
s1[3]=t1/t2;
for(i3=0;i3<4;i3++){
if(i3!=i1&&i3!=i2){
t3=choice[i3];
for(v=0;v<4;v++)
{ s2[v][0]=s1[v]+t3;
s2[v][1]=s1[v]-t3;
s2[v][2]=s1[v]*t3;
s2[v][3]=s1[v]/t3;}
for(i4=0;i4<4;i4++){
if(i4!=i1&&i4!=i2&&i4!=i3){
t4=choice[i4];
for(n1=0;n1<4;n1++)for(n2=0;n2<4;n2++)
if(s2[n1][n2]+t4==||s2[n1][n2]-t4==||s2[n1][n2]*t4==||s2[n1][n2]/t4==){
cout<<"æ¾å°ä¸ç§ç»åæ¹æ¡ï¼\n(("<<t1;
if(s1[n1]==t1+t2)cout<<" + ";
if(s1[n1]==t1-t2)cout<<" - ";
if(s1[n1]==t1*t2)cout<<" * ";
if(s1[n1]==t1/t2)cout<<" / ";
if(n2==0)cout<<t2<<") + "<<t3;
if(n2==1)cout<<t2<<") - "<<t3;
if(n2==2)cout<<t2<<") * "<<t3;
if(n2==3)cout<<t2<<") / "<<t3;
if(s2[n1][n2]+t4==)cout<<") + "<<t4<<" = \n";
if(s2[n1][n2]-t4==)cout<<") - "<<t4<<" = \n";
if(s2[n1][n2]*t4==)cout<<") * "<<t4<<" = \n";
if(s2[n1][n2]/t4==)cout<<") / "<<t4<<" = \n";
num++;
}
}}}
}}}}
for(i1=0;i1<4;i1++){
t1=choice[i1];
for(i2=0;i2<4;i2++){
if(i2!=i1){
t2=choice[i2];
s1[0]=t1*t2;
s1[1]=t1/t2;
for(i3=0;i3<4;i3++){
if(i3!=i1&&i3!=i2){
t3=choice[i3];
for(i4=0;i4<4;i4++){
if(i4!=i1&&i4!=i2&&i4!=i3){
t4=choice[i4];
s3[0]=t3*t4;
s3[1]=t3/t4;
for(n1=0;n1<2;n1++)for(n2=0;n2<2;n2++)
if(s1[n1]+s3[n2]==||s1[n1]-s3[n2]==){
cout<<"æ¾å°ä¸ç§ç»åæ¹æ¡ï¼\n("<<t1;
if(s1[n1]==t1*t2)cout<<" * ";
if(s1[n1]==t1/t2)cout<<" / ";
if(s1[n1]+s3[n2]==)cout<<t2<<") + ("<<t3;
if(s1[n1]-s3[n2]==)cout<<t2<<") - ("<<t3;
if(s3[n2]==t3*t4)cout<<" * "<<t4<<") = \n";
if(s3[n2]==t3/t4)cout<<" / "<<t4<<") = \n";
num++;
}
}}}
}}}}
cout<<"æ»å ±æ"<<num<<"ç§è§£æ³ã\n";
if(num==0)cout<<"è¿åå¼ çæ æ³ææç¹~~~\n";
num=0;
}
return 0;
}
java中byte a =(byte)为什么输出成-求大
这里没涉及原码补码反码吧,byte a =(byte)意思是反码把一个整形的转换为一个byte型的,由于byte类型的补码通用注册机源码取舍范围只有-~,超出byte的源码取舍范围了,就从最小值-开始循环,反码微信游戏下载源码比如(byte)比大1,补码html黑页源码分享接着就再取一位,源码也就是反码-,所以(byte)打印出来就是补码-了。(byte)打印出来就是源码-,这样循环轮回地取舍,反码byte a =(byte)输出成- 也一样道理。补码
至于原码补码反码这些,源码生鲜微信商城源码个人觉得,反码有些基本了解即可,补码小程序答题助手源码平时接触得不多,可以在用到的时候再深入学习,否则很容易忘记。