我有这个表,我添加到表中的行越多,表和表格上方的文本之间形成的空间就越多。
$qq=mysql_query("SELECT * FROM piatto");
echo "<table border=1>
<tr>
<th>ID</th>
<th>Nome</th>
<th>Descrizione</th>
<th>Tempo</th>``
<th>Prezzo</th>
<th>quantita</th>
</tr>";
while($cicle=mysql_fetch_array($qq)){
echo "<tr>";
echo "<td>". $cicle['id']."</td>";
echo "<td>". $cicle['titolo']."</td>";
echo "<td>". $cicle['descrizione']."</td>";
echo "<td>". $cicle['tempo_preparazione']."</td>";
echo "<td>". $cicle['prezzo']."</td>";
echo "<td>". $cicle['quantita']."</td>";
echo "</tr>";
echo "<br />";
}
echo "</table>" ;
echo"<br />";`enter code here`
我该如何解决这个问题?
答案 0 :(得分:2)
表格中private final static Pattern PATTERN = Pattern.compile("(.*)([+-])(.*)i");
// ...
String complexInput = get.next();
final Matcher matcher = PATTERN.matcher(complexInput);
if (matcher.find()) {
final double imgSign = matcher.group(2).equals("+") ? 1D : -1D;
final double real = Double.parseDouble(matcher.group(1));
final double img = Double.parseDouble(matcher.group(3));
return new Complex(real, imgSign * img);
}
的原因是什么?因为它没有包含在public class Driver {
private final static Pattern PATTERN = Pattern.compile("(.*)([+-])(.*)i");
private static final int CHOICE_EXIT = 5;
private static final int CHOICE_ADD = 1;
public static void main(String[] args) {
Scanner get = new Scanner(System.in);
int choice;
Complex c1;
Complex c2;
while (true) {
try {
printInfoAboutChoice();
choice = get.nextInt();
if (choice == CHOICE_EXIT) {
break;
}
System.out.println("Enter first complex number: ");
c1 = getComplexFromString(get.next());
System.out.println("Enter Second complex number: ");
c2 = getComplexFromString(get.next());
} catch (RuntimeException e) {
System.err.println(e.getMessage());
continue;
}
switch (choice) {
case CHOICE_ADD: {
Complex c3 = c1.add(c2);
System.out.println(c3.toString());
}
// TODO others methods...
}
}
}
private static Complex getComplexFromString(String complexInput) throws IllegalFormatException {
final Matcher matcher = PATTERN.matcher(complexInput);
if (matcher.find()) {
final double imgSign = matcher.group(2).equals("+") ? 1D : -1D;
final double real = Double.parseDouble(matcher.group(1));
final double img = Double.parseDouble(matcher.group(3));
return new Complex(real, imgSign * img);
}
throw new IllegalArgumentException("Bad complex number input");
}
private static void printInfoAboutChoice() {
System.out.println("Please type your choice and enter : ");
System.out.println("1.Add Two Complex Numbers");
System.out.println("2.Substract Two Complex Numbers");
System.out.println("3.Multiply Two Complex Numbers");
System.out.println("4.Divide Two Complex Numbers");
System.out.println("5.Exit Program");
}
}
中,所以它不会作为表格的一部分包含在内,而是实际显示在表格的上方。由于<br />
是你的while循环的一部分,你拥有的行越多,你在桌子上方就会有更多的休息。
如果您想增加行之间的间距,请使用CSS或只包含一个空表行。