'commit'
This commit is contained in:
23
C++课程/第二课字节与进制转换/10to2.cpp
Normal file
23
C++课程/第二课字节与进制转换/10to2.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
int n=12;
|
||||
int i,j=0;
|
||||
int a[1000];
|
||||
|
||||
i=n;
|
||||
while(i)
|
||||
{
|
||||
a[j]=i%2;
|
||||
i/=2;
|
||||
j++;
|
||||
}
|
||||
for(i=j-1;i>=0;i--)
|
||||
{
|
||||
cout<<a[i];
|
||||
}
|
||||
cout<<endl;
|
||||
return 0;
|
||||
}
|
||||
34
C++课程/第二课字节与进制转换/2to10.cpp
Normal file
34
C++课程/第二课字节与进制转换/2to10.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include<iostream>
|
||||
#include<conio.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD> x<><78>n<EFBFBD>η<EFBFBD>
|
||||
double power (int x, int n)
|
||||
{
|
||||
int result=1;
|
||||
for(int i=0;i<n;i++)
|
||||
{
|
||||
result=result*x;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int all=0;
|
||||
string p = "1011";
|
||||
for( int i=0;i<p.length();i++)
|
||||
{
|
||||
if(p[p.length()-i-1]=='1')
|
||||
{
|
||||
all=all+power(2,i);
|
||||
}
|
||||
}
|
||||
cout<<all<<endl;
|
||||
|
||||
getch();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
7
C++课程/第二课字节与进制转换/exam11.cpp
Normal file
7
C++课程/第二课字节与进制转换/exam11.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"I love programming."<<endl;
|
||||
return 0;
|
||||
}
|
||||
8
C++课程/第二课字节与进制转换/exam12.cpp
Normal file
8
C++课程/第二课字节与进制转换/exam12.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<20/7<<endl;
|
||||
cout<<20%7<<endl;
|
||||
return 0;
|
||||
}
|
||||
7
C++课程/第二课字节与进制转换/exam13.cpp
Normal file
7
C++课程/第二课字节与进制转换/exam13.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<9/8<<4*(6+3)%5<<endl;
|
||||
return 0;
|
||||
}
|
||||
12
C++课程/第二课字节与进制转换/exam14.cpp
Normal file
12
C++课程/第二课字节与进制转换/exam14.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
cout<<"9/8="<<9/8<<endl;
|
||||
|
||||
// cout<<9/8<<4*(6+3)%5<<(4*6+3)%5<<endl;
|
||||
// cout<<9/8<<" "<<4*(6+3)%5<<" "<<(4*6+3)%5<<endl;
|
||||
// cout<<"9/8="<<9/8<<" 4*(6+3)%5="<<4*(6+3)%5<<" (4*6+3)%5="<<(4*6+3)%5<<endl;
|
||||
return 0;
|
||||
}
|
||||
16
C++课程/第二课字节与进制转换/exam15.cpp
Normal file
16
C++课程/第二课字节与进制转换/exam15.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD>ŵĽ<C5B5><C4BD><EFBFBD><EFBFBD>취
|
||||
//https://blog.csdn.net/honest_boy/article/details/85934199
|
||||
|
||||
int main()
|
||||
{
|
||||
cout << "8000<EFBFBD><EFBFBD>=";
|
||||
cout << 8000 / 3600 << "Сʱ";
|
||||
cout << (8000 % 3600) / 60 << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
cout << 8000 % 3600 % 60 << "<EFBFBD><EFBFBD>" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
8
C++课程/第二课字节与进制转换/exam16.cpp
Normal file
8
C++课程/第二课字节与进制转换/exam16.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
cout<<"5<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 6<><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
cout<<90.0/3/4*5*6<<"ƽ<EFBFBD><EFBFBD><EFBFBD>ذ<EFBFBD>ש<EFBFBD><EFBFBD>"<<endl;
|
||||
return 0;
|
||||
}
|
||||
14
C++课程/第二课字节与进制转换/smaple.cpp
Normal file
14
C++课程/第二课字节与进制转换/smaple.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include<iostream>
|
||||
#include<conio.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٻ<EFBFBD><EFBFBD><EFBFBD>ѧԱ<EFBFBD><EFBFBD>"<<endl;
|
||||
getch();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
BIN
C++课程/第二课字节与进制转换/字节与进制转换.pptx
Normal file
BIN
C++课程/第二课字节与进制转换/字节与进制转换.pptx
Normal file
Binary file not shown.
Reference in New Issue
Block a user