TJ

刘嘉柚  •  1年前


链表

→←

#include <iostream>
#define ll long long
using namespace std;
const int N=5;
struct node{
	ll val,nxt;
}node[N];
int head=0,tot=0;

void Insert(ll x){
	tot++;
	node[tot].val=x;
	node[tot].nxt=head;
	head=tot;
}
int cntsum(){
	ll sum=0;
	for(ll i=head;i!=0;i=node[i].nxt){
		sum+=node[i].val;
	}
	return sum;
}

int main(){
    for(int i=1;i<=2;i++){
    	ll x;
    	cin>>x;
    	Insert(x);
	}
	cout<<cntsum();
    return 0;
}

下滑有牢大

Man

What

can

I

Say?

Manba

Out

Man

What

can

I

Say?

Manba

Out

Man

What

can

I

Say?

Manba

Out

Man

What

can

I

Say?

Manba

Out

Man

What

can

I

Say?

Manba

Out

Man

What

can

I

Say?

Manba

Out

Man

What

can

I

Say?

Manba

Out

Man

What

can

I

Say?

Manba

Out Man

What

can

I

Say?

Manba

Out

Man

What

can

I

Say?

Manba

Out

Man

What

can

I

Say?

Manba

Out

Man

What

can

I

Say?

Manba

Out


评论:

LLLLLLLLLL


baim.  •  1年前
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
string player="Guest_1001";

struct Node{
	string s;
	int damage;
	int health;
};
Node v[6];
int i=5,j=0;
Node bag[100005];
void print_order(){
	cout<<setw(30)<<"\ncoonist.io 1.0\n";
	cout<<"    基础操作:\n"; 
	cout<<"    1.无尽模式\n";
	cout<<"    2.对决模式(未开发)\n";
	cout<<"    3.打开背包\n";
	cout<<"    4.合成武器(未开发)\n";
	cout<<"    5.注册账号\n";
	cout<<"    6.退出游戏(销毁存档)\n";
}
void init(){
	j++;
	bag[j].s="rock_Mythic";
	bag[j].damage=850;
	bag[j].health=425;
	j++;
	bag[j].s="knife_Mythic";
	bag[j].damage=1440;
	bag[j].health=1510;
	for(int p=1;p<=5;p++){
		v[p].s="classic_Normal";
		v[p].damage=10;
		v[p].health=5;
	}
}

int main(){
	init();
	int f=0;
	while(1){
		print_order();
		int op;
		cin>>op;
		switch(op){
			case 1:{
				cout<<player<<"加入了游戏";
				break;
			}
			case 3:{
				cout<<" 你的装备栏:";
				for(int p=1;p<=5;p++){
					cout<<v[p].s<<" damage:"<<v[p].damage<<" health:"<<v[p].health<<"    ";
				}
				cout<<"\n\n 你的背包:";
				if(i==0) cout<<"NONE";
				else{
					for(int p=1;p<=j;p++) cout<<bag[p].s<<" damage:"<<bag[p].damage<<" health:"<<bag[p].health<<"    ";
				}
				int t1,t2;
				cout<<"\n\n请输入要替换的装备的背包位置(格式:背包位置 装备位置):";
				cin>>t1>>t2;
				if(t1<=j&&t2<=5){
					swap(bag[t1].s,v[t2].s);
					swap(bag[t1].damage,v[t2].damage);
					swap(bag[t1].health,v[t2].health);
				}
				else cout<<"装备位置不符合\n";
				for(int p=1;p<=5;p++){
					cout<<v[p].s<<" damage:"<<v[p].damage<<" health:"<<v[p].health<<"    ";
				}
				Sleep(5000);
				system("cls");
				break;
			}
			case 5:{
				++f;
				if(f==2) break;
				cout<<"请输入用户名:";
				cin>>player;
				break;
			}
			case 6:{
				return 0;
				break;
			} 
		}
	}
	return 0;
}

entity  •  1年前