'\n'是 Linux上的换行
'\r\n'才是Windows上的换行
试过了,是真的。。。
只需要把‘\’ 变成‘\\’即可
Java编写代码过程中遇到了一个问题,main方法中创建内部类的实例时,编译阶段出现错误,查看错误描述:
Multiple markers at this line
- The value of the local variable test is not used
- No enclosing instance of type StaticCallDynamic is accessible. Must qualify the allocation with an enclosing instance of type StaticCallDynamic (e.g...
public class passwordVerify {
public static void main(String[] args)
{
// TODO Auto-generated method stub
verify();
}
public static void verify()
{
String originalUserName = "cs1053283896@gmail.com" ; //账号密码信息
String originalUserPassword = "123456789" ;
Scanner myscanner = new...
public static void main(String[] args) {
// TODO Auto-generated method stub
String aString = "hellocensi @gmail.com " ;
System.out.println(aString);
int lenthString=aString.length();
System.out.println("way1:"+lenthString);//常用方法1:获取字符串长度
char str[]=aString.toCharArray(); //常用方法2 :...
#include<stdio.h>
#include<stdlib.h>
#define N 13 //总人数
typedef struct Node
{
int Data;
struct Node *Next;
}List,*Position;
Position Create(void);
Position Delete(Position Head,Position P);
Position Deal(Position Head);
void Traverse(Position Head);
int main() //测试
{
P...
public static void main(String[] args)
{
double sprt20=Math.sqrt(20);
sprt20=(float)Math.round(sprt20*10000)/10000.0; //关键:10^n,n表示小数点后位数,且后面的10^n须带一位小数点
System.out.print(sprt20);
}
结果:4.4721
#include<iostream>
#include<cstdlib>
using namespace std;
#define RED 1
#define BLACK 0
typedef struct TreeNode
{
int Element;
int Color;
TreeNode *Parent;
TreeNode *Left;
TreeNode *Right;
TreeNode()
{
Color=BLACK; //let initial node become black
}
}*MyRBTree;
MyRBTree ...
#include<iostream>
#include<cstdlib>
using namespace std;
typedef struct TreeNode
{
int Element;
int Height;
TreeNode *Left;
TreeNode *Right;
}*MyAVLTree;
MyAVLTree MakeEmpty(MyAVLTree &T);
void InorderTraverse(const MyAVLTree &T);
static int Max(int a,int b);
static int ...
#include<iostream>
#include<cstdlib>
using namespace std;
/*查找二叉树,这里用的都是无敌的递归方法,因为它极容易理解,
也很容易编程,但值得注意的是返回值很重要*/
typedef struct TreeNode
{
int Element;
TreeNode *Left;
TreeNode *Right;
}TreeNode,*MyTree;
MyTree MakeEmpty(MyTree &T); //二叉树置空
void InorderTraverse(const MyTree ...
一开始我用的变量是局部的它的毛病就是所有的操作只能做一次,然后啥也没改变。
那么解决的一个方法就是 引用地址
引用地址使得全局有效
不说了
直接上上点代码
typedef struct TreeNode
{
char Element;
TreeNode *Left;
TreeNode *Right;
}*MyTree;
void Exchange(MyTree T)
{
if(T)
{
MyTree Temp=NULL;
if(T->Left||T->Right)
{
...
#include<iostream>
#include<cstdlib>
#define MAX 100
using namespace std;
typedef struct Queue
{
int Array[MAX];
int Front;
int Rear;
} *CircleQueue;
CircleQueue Create(void); //创建一个队列
int IsEmpty(CircleQueue Q); //是否为空
int IsFull(CircleQueue Q); //是否已满
void EnQueue(Circle...
#include<iostream>
#include<cstdlib>
using namespace std;
typedef struct Queue
{
int *Array;
int Front,Rear;
}*MyQueue;
MyQueue Create(void); //创建一个队列
int IsEmpty(MyQueue Q); //检验是否为空栈
void DeQueue(MyQueue Q); //出队
void EnQueue(int X,MyQueue Q); //入队
void GetQueueFront(MyQ...
#include<iostream>
#include<cstdlib>
#define MAXSIZE 100
using namespace std;
typedef struct Node
{
struct Node *Next; //队列元素的节点连接
int Element;
}MyNode;
typedef struct Queue
{
Node *Front; //Front和Rear连接着各自应有的节点
Node *Rear;
int Items; //队列元素的个数,用于判断是否空队列,...
#include<iostream>
#include<cstdlib>
#define LEN sizeof(struct Node)
using namespace std;
struct Node;
typedef struct Node *PtrToNode;
typedef PtrToNode Position;
struct Node //节点
{
int Element ;
struct Node *Next;
};
int IsEmpty(Position Top); //检验空栈
void GetStackTo...
#include<iostream>
#include<cstdlib>
using namespace std;
int *Array=NULL;
int Count=0;
void Initial(int Size); //初始化栈
void Push(int Element); //入栈
int GetStackLenth(void);//获取栈的个数
void GetTopOfStack(void);//栈顶元素
void Pop(void); //出栈
void Traverse(void); //遍历
voi...
//我发现,插入操作时,总是先把New与已有节点连接
#include<iostream>
#include<cstdlib>
#define LEN sizeof(struct Node)
using namespace std;
typedef struct Node *PtrToNode;
typedef PtrToNode Position;
struct Node
{
int Element;
struct Node *Last;
struct Node *Next;
};
Position Create(void); ...
#include<iostream>
#include<cstdlib>
using namespace std;
#define LEN sizeof(struct Node)
#define N 6
typedef struct Node *PtrToNode;
typedef PtrToNode Position;
struct Node
{
int Element;
struct Node *Next;
};
Position Create(void); //创建一个循环链表
void Taverse(Position Hea...
#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
struct Node;
typedef struct Node *PtrToNode;
//typedef PtrToNode List;
typedef PtrToNode Position;
struct Node
{
int Element; //元素
//int Subscrit; //下标
struct Node *Next;
};
Position Create(void); //创建链表
void ...
#include<iostream>
#include<cmath>
#include<cstdlib>
using namespace std;
const int SHIP=1;
const int BAR=2;
const int WATER=3;
int drunkard(void)
{
int x=-10; //酒者一开始在酒馆
int y=0; //酒者一开始在跳板中央
int step=0; //初始化酒者的步数
while(abs(x)<=10&&abs(y)<=2)
{
switch(rand()%...