Redian新闻
>
tex里面加email碰到难题。
avatar
tex里面加email碰到难题。# TeX - TeX电子排版系统
r*o
1
美国州立大学计算机系PhD, 英文paper6篇,中文paper10多篇,都是第一作者,不过
没啥引用。
担任一个杂志的Editorial Board和两个一般会议的TPC。
Review过paper 30多篇,其中包括一些档次不错的杂志和会议。
现在一家大公司做Principal Engineer。
感觉研究背景不是很强,这样的背景能申请EB1A或EB1B吗?
avatar
n*i
2
主要是第一个comment那边,输入yes or no 然后取出第一个char赋值给tryAgain,我
用了tryAgain = scan.findInLine(".").charAt(0); 跑下来是出现一个框,根本就没
有赋值给tryAgain,求大神帮忙指点下,我哪里出错了。另外我用switch没问题吧
import java.util.Scanner;
import java.util.Random;
public class RockPaperScissors {

private static String[] choices = { "Rock", "Paper", "Scissors" };

public static void main (String[] args){

Scanner scan = new Scanner(System.in);
Random rGen = new Random();

String name;
int playerChoiceNum;
String playerChoice;

int computerChoiceNum;
String computerChoice;

char tryAgain;
String playerMessage = null;

System.out.print("What is your name? ");
name = scan.nextLine();
System.out.println();

System.out.print("1 = Rockn2 = Papern3 = ScissorsnPlease choose 1, 2, or
3: ");
playerChoiceNum = scan.nextInt(); scan.nextLine();
playerChoice = choices[playerChoiceNum - 1];
System.out.println();

computerChoiceNum = Math.abs(rGen.nextInt()) % 3 + 1;
computerChoice = choices[computerChoiceNum - 1];

// If the player and computer are tied OR the
// computer is beating the player, then...
// Ask the user if he is sure about his choice,
// as a yes/no
// Store the first character of the user's
// response in the variable tryAgain
// If the answer is no, then...
// Repeat the lines of code that got the
// user's choice the first time

// YOUR CODE GOES HERE
switch(computerChoiceNum - playerChoiceNum)
{
case -2:
System.out.println(name +", are you Sure you want to choose " +
playerChoice + "?" + "(Yes or No)");
break;
case 0:
System.out.println(name +", are you Sure you want to choose " +
playerChoice + "?" + "(Yes or No)");

break;
case 1:
System.out.println(name +", are you Sure you want to choose " +
playerChoice + "?" + "(Yes or No)");

break;
}

scan.nextLine();

tryAgain = scan.findInLine(".").charAt(0);
do {
System.out.print("1 = Rockn2 = Papern3 = ScissorsnPlease choose 1, 2,
or 3: ");
playerChoiceNum = scan.nextInt(); scan.nextLine();
playerChoice = choices[playerChoiceNum - 1];
System.out.println();

computerChoiceNum = Math.abs(rGen.nextInt()) % 3 + 1;
computerChoice = choices[computerChoiceNum - 1];
}
while (tryAgain =='N');




System.out.printf("%s, you chose %s.%n", name, playerChoice);
System.out.printf("The computer chose %s.%n", computerChoice);
System.out.println();

// If the player and computer made the same choice, then...
// Announce that it's a tie.
// Otherwise, based upon the player's and computer's
// respective choices, announce what beats what and
// and tell the player whether he wins or loses.
// YOUR CODE GOES HERE
switch (playerChoiceNum - computerChoiceNum)
{ case -2 :
System.out.println("Rock breaks Scissors...you win!");
break;
case -1 :
if(playerChoiceNum == 2 )
System.out.println("Scissors cut Paper...you lost!");
else
System.out.println("Paper covers Rock...you lost!");
break;

case 0 :
System.out.println(name + " you and the computer both chose " +
playerChoiceNum + ", so it's a tie.");
break;
case 1 :
if(playerChoiceNum == 3)
System.out.println("Scissors cut Paper...you win!");
else
System.out.println("Paper covers Rock...you win!");
break;

case 2 :
System.out.println("Roch breaks Scissors...you lost!");
break;
}


System.out.println(playerMessage);

}

}
avatar
q*j
3
我使一招:
\href{mailto: myemail}{myemail}
一般就好了。可是问题在于我的email address里面有下划线like m*****[email protected]
那么我就写成: my$\_$n**[email protected]。因为tex强迫我进入数学模式来输入下划线。
但是出来了pdf以后一点进入outlook,地址真的就成了my$_$n**[email protected]。这不是
土大了?
请高手赐一副解药!
avatar
r*o
4
美国州立大学计算机系PhD, 英文paper6篇,中文paper10多篇,都是第一作者,不过
没啥引用。
担任一个杂志的Editorial Board和两个一般会议的TPC。
Review过paper 30多篇,其中包括一些档次不错的杂志和会议。
现在一家大公司做Principal Engineer。
感觉研究背景不是很强,这样的背景能申请EB1A或EB1B吗?
avatar
b*y
5
这么长的程序,要网上的人免费给回答的话,估计很难了。这种应该去找个tutor解决
avatar
g*r
6
为什么要使用数学模式?直接用 my\_***[email protected] 不行吗?

com。

【在 q**j 的大作中提到】
: 我使一招:
: \href{mailto: myemail}{myemail}
: 一般就好了。可是问题在于我的email address里面有下划线like m*****[email protected]
: 那么我就写成: my$\_$n**[email protected]。因为tex强迫我进入数学模式来输入下划线。
: 但是出来了pdf以后一点进入outlook,地址真的就成了my$_$n**[email protected]。这不是
: 土大了?
: 请高手赐一副解药!

avatar
c*l
7
eb1b no problem. imop
avatar
m*u
8
没有parse输入成int,是一个很明显的error。另外,“1=papern....",每个选项之后
都有个n,这不知是个typo(你贴到这里的typo),还是你运行程序就这样的。我觉得
这也应该是个error。
avatar
q*j
9
就是就是。我刚刚发现了。现在没有问题了。多谢。
avatar
b*u
10
经典的解法是用double dispatch pattern.
avatar
t*s
11
use
\href{mailto:y*****[email protected]}{\verb{y******[email protected]}}

com。

【在 q**j 的大作中提到】
: 我使一招:
: \href{mailto: myemail}{myemail}
: 一般就好了。可是问题在于我的email address里面有下划线like m*****[email protected]
: 那么我就写成: my$\_$n**[email protected]。因为tex强迫我进入数学模式来输入下划线。
: 但是出来了pdf以后一点进入outlook,地址真的就成了my$_$n**[email protected]。这不是
: 土大了?
: 请高手赐一副解药!

avatar
q*j
12
多谢。\verb在第二个如何我不清楚。在第一个里面不行。我其实不需要进入math mode
的。我本来以为下划线只在math mode里面才能产生。
avatar
t*s
13
you don't need anything in the first {}. that's the hyperlink.

mode

【在 q**j 的大作中提到】
: 多谢。\verb在第二个如何我不清楚。在第一个里面不行。我其实不需要进入math mode
: 的。我本来以为下划线只在math mode里面才能产生。

avatar
q*j
14
thanks for the reminder.

【在 t***s 的大作中提到】
: you don't need anything in the first {}. that's the hyperlink.
:
: mode

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。