forked from newde/homework
Compare commits
19 Commits
hehe-patch
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 885a1b3efb | |||
| 83d761d20b | |||
| 91da12510e | |||
| f9a50b3be6 | |||
| eb13818869 | |||
| c5a0d78354 | |||
| 6cfca39335 | |||
| 17ac063f22 | |||
| dbca0f836c | |||
| 8d012e9523 | |||
| 8633a4877f | |||
| e268fd03a2 | |||
| f5c717b856 | |||
| 9fdfe16b58 | |||
| 7aecf0da37 | |||
| 9e50890b5d | |||
| 7c42adee66 | |||
| dcbb90437b | |||
| 56b2815398 |
39
188.cpp
Normal file
39
188.cpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
int a[5];
|
||||||
|
int max;
|
||||||
|
bool bl=true;
|
||||||
|
cout<<"请输入5个整数"<<endl;
|
||||||
|
for(int i=0;i<5;i++)
|
||||||
|
{
|
||||||
|
cin>>a[i];
|
||||||
|
}
|
||||||
|
for(int i=0;i<5;i++)
|
||||||
|
{
|
||||||
|
for(int j=0;j<4-i;j++)
|
||||||
|
{
|
||||||
|
if(a[j]>a[j+1])
|
||||||
|
{
|
||||||
|
max=a[j];
|
||||||
|
a[j]=a[j+1];
|
||||||
|
a[j+1]=max;
|
||||||
|
bl=false;
|
||||||
|
}
|
||||||
|
if(!bl)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for(int n=0;n<5;n++) {
|
||||||
|
|
||||||
|
cout<<a[n]<<" ";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cout<<endl;
|
||||||
|
|
||||||
|
cout<<"阿哈哈哈啊哈哈哈哈,我我没有输出!!!"<<endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
0
202604116173859
Normal file
0
202604116173859
Normal file
0
20264116173940
Normal file
0
20264116173940
Normal file
20
260314/03.cpp
Normal file
20
260314/03.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
for(int i=2;i<100;i++){
|
||||||
|
bool n=true;
|
||||||
|
|
||||||
|
for(int j=2;j*j<=i;j++){
|
||||||
|
|
||||||
|
if(i%j==0){
|
||||||
|
n=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(n)
|
||||||
|
cout<<i<<" ";
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
20
260314/100以内的素数.cpp
Normal file
20
260314/100以内的素数.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
for(int i=2;i<100;i++){
|
||||||
|
bool n=true;
|
||||||
|
|
||||||
|
for(int j=2;j*j<=i;j++){
|
||||||
|
|
||||||
|
if(i%j==0){
|
||||||
|
n=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(n)
|
||||||
|
cout<<i<<" ";
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
20
260314/两数交换指针.cpp
Normal file
20
260314/两数交换指针.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include<iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
int * ptr_a,* ptr_b;
|
||||||
|
ptr_a = new int;
|
||||||
|
ptr_b = new int;
|
||||||
|
int temp;
|
||||||
|
|
||||||
|
cin>>*ptr_a>>*ptr_b;
|
||||||
|
temp=*ptr_a;
|
||||||
|
*ptr_a=*ptr_b;
|
||||||
|
*ptr_b=temp;
|
||||||
|
cout<<*ptr_a<<" "<<*ptr_b<<endl;
|
||||||
|
delete ptr_a,ptr_b;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
18
260314/最大值指针.cpp
Normal file
18
260314/最大值指针.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
int a[10]={1,200,315,4,5,6,71,8,9,10};
|
||||||
|
int *b=a;
|
||||||
|
|
||||||
|
for(int i=1;i<10;i++)
|
||||||
|
if(*b<a[i])
|
||||||
|
*b=a[i];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cout<<*b<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
22
666/01.cpp
Normal file
22
666/01.cpp
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
int t=0;
|
||||||
|
int h=0;
|
||||||
|
|
||||||
|
while(h<=17){
|
||||||
|
t++;
|
||||||
|
h+=3;
|
||||||
|
|
||||||
|
if(h>=17)
|
||||||
|
break;
|
||||||
|
|
||||||
|
t++;
|
||||||
|
h--;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout<<"需要"<<t<<"分钟"<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
666/02.2.0.cpp
Normal file
18
666/02.2.0.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
void bjdx(int a,int b){
|
||||||
|
|
||||||
|
|
||||||
|
if(a>b)
|
||||||
|
|
||||||
|
cout<<a<<"大大大大大大大大大大大大大大大大大大大大大大大大大"<<endl;
|
||||||
|
else
|
||||||
|
|
||||||
|
cout<<b<<"大大大大大大大大大大大大大大大大大大大大大大大大大"<<endl;
|
||||||
|
}
|
||||||
|
int main(){
|
||||||
|
int a,b;
|
||||||
|
cin>>a>>b;
|
||||||
|
bjdx(a,b);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
666/02.2.1
Normal file
BIN
666/02.2.1
Normal file
Binary file not shown.
16
666/02.2.2.cpp
Normal file
16
666/02.2.2.cpp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int bjdx(int a){
|
||||||
|
int b=1;
|
||||||
|
for(int i=1;i<=a;i++)
|
||||||
|
b=b*i;
|
||||||
|
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
int main(){
|
||||||
|
int pdd;
|
||||||
|
cin>>pdd;
|
||||||
|
cout<<bjdx(pdd)<<endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
15
666/02.cpp
Normal file
15
666/02.cpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
|
||||||
|
int zuidazhi
|
||||||
|
int a[5];
|
||||||
|
int man=a[0];
|
||||||
|
for(int i=0;i<4;i++){
|
||||||
|
if(a[i]>man)
|
||||||
|
man=a[i];
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
14
666/03.cpp
Normal file
14
666/03.cpp
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int jia(int i,int j){
|
||||||
|
int n;
|
||||||
|
i+j=n
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
int main(){
|
||||||
|
int n,a,b;
|
||||||
|
cin>>a>>b;
|
||||||
|
cout<<n<<endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
15
666/dog.cpp
Normal file
15
666/dog.cpp
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#include<iostream>
|
||||||
|
#include<numeric>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
int zhang,li;
|
||||||
|
cin>>zhang>>li;
|
||||||
|
|
||||||
|
int a=lcm(zhang,li);
|
||||||
|
|
||||||
|
cout<<"张三和李四下次相遇是:"<<a<<" 天以后。"<<endl;
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
20
666/nd.cpp
Normal file
20
666/nd.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include<iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
int * ptr_a,* ptr_b;
|
||||||
|
ptr_a = new int;
|
||||||
|
ptr_b = new int;
|
||||||
|
int temp;
|
||||||
|
|
||||||
|
cin>>*ptr_a>>*ptr_b;
|
||||||
|
temp=*ptr_a;
|
||||||
|
*ptr_a=*ptr_b;
|
||||||
|
*ptr_b=temp;
|
||||||
|
cout<<*ptr_a<<" "<<*ptr_b<<endl;
|
||||||
|
delete ptr_a,ptr_b;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
20
666/pig.cpp
Normal file
20
666/pig.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int mypai(int arr[],int b) {
|
||||||
|
int max=arr[0];
|
||||||
|
for(int j=1;j<5;j++)
|
||||||
|
if(max < arr[j])
|
||||||
|
|
||||||
|
max=arr[j];
|
||||||
|
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
int a[5]={110,2,13,22,4};
|
||||||
|
int max=mypai(a,5);
|
||||||
|
cout<< max << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
666/zhu.cpp
Normal file
18
666/zhu.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int myadd(int x,int y);
|
||||||
|
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
int a,b,c;
|
||||||
|
cin>>a >>b;
|
||||||
|
c=myadd(a,b);
|
||||||
|
cout << c << endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
13
666/交换.cpp
Normal file
13
666/交换.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
int a,b,c;
|
||||||
|
cin>>a>>b;
|
||||||
|
cout<<a<<" "<<b<<" ";
|
||||||
|
c=a;
|
||||||
|
a=b;
|
||||||
|
b=c;
|
||||||
|
cout<<a<<" "<<b<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
13
666/交换2.cpp
Normal file
13
666/交换2.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
int a,b,c;
|
||||||
|
cin>>a>>b;
|
||||||
|
cout<<a<<" "<<b<<" ";
|
||||||
|
c=a;
|
||||||
|
a=b;
|
||||||
|
b=c;
|
||||||
|
cout<<a<<" "<<b<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
18
666/交换3.cpp
Normal file
18
666/交换3.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
int a=25,b=32,tmp;
|
||||||
|
int *ptr_a, *ptr_b;
|
||||||
|
|
||||||
|
ptr_a=&a;
|
||||||
|
ptr_b=&b;
|
||||||
|
|
||||||
|
cout<<*ptr_a<<" "<<*ptr_b<<" ";
|
||||||
|
cout<<ptr_a<<" "<<ptr_b<<" ";
|
||||||
|
tmp=*ptr_a;
|
||||||
|
*ptr_a=*ptr_b;
|
||||||
|
*ptr_b=tmp;
|
||||||
|
cout<<a<<" "<<b<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
666/冒泡排序函数版
Normal file
BIN
666/冒泡排序函数版
Normal file
Binary file not shown.
16
666/最大值.cpp
Normal file
16
666/最大值.cpp
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int mymax(int x_int,int y_int){
|
||||||
|
if(x_int>y_int)
|
||||||
|
return x_int;
|
||||||
|
else;
|
||||||
|
return y_int;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
int i,j;
|
||||||
|
cin>>i>>j;
|
||||||
|
cout<<mymax(i,j)<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
24
666/最大值2.cpp
Normal file
24
666/最大值2.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
int a[5]={87,99,3,12,1};
|
||||||
|
int max=a[0];
|
||||||
|
int * ptr_x;
|
||||||
|
ptr_x=a;
|
||||||
|
|
||||||
|
|
||||||
|
for(int i=1;i<5;i++){
|
||||||
|
|
||||||
|
if(*ptr_x > max){
|
||||||
|
max = *ptr_x;
|
||||||
|
}
|
||||||
|
ptr_x++;
|
||||||
|
cout<<ptr_x<<endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
cout<<max<<" ";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
17
666/最大值3.cpp
Normal file
17
666/最大值3.cpp
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#include<iostream>
|
||||||
|
using namespace std;
|
||||||
|
int main(){
|
||||||
|
int a[5]={9,99,999,9999,99999};
|
||||||
|
int *ptr_x;
|
||||||
|
int max;
|
||||||
|
ptr_x=a;
|
||||||
|
max=*ptr_x;
|
||||||
|
for(int i=1;i<=5;i++){
|
||||||
|
if(*ptr_x>max)
|
||||||
|
max=*ptr_x;
|
||||||
|
ptr_x++;
|
||||||
|
}
|
||||||
|
cout<<max<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user