- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
所以我刚刚开始用java编程,并尝试制作一个TicTicToeGame,它成功了:)问题是,你只能玩1个TicTacToe游戏,所以我想制作一个重新启动游戏的按钮和一个按钮退出游戏。因为我添加了这个并尝试在我的手机上运行它,所以当我启动它时它崩溃了。这是我的 MainActivity.java:
package com.example.testjk;
import android.support.v7.app.ActionBarActivity;
import android.content.Context;
import android.graphics.Color;
import android.inputmethodservice.ExtractEditText;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends ActionBarActivity implements OnClickListener{
private TicTacToeGame mGame;
private Button mBoardButtons[];
private TextView mInfoTextView;
private TextView mHumanCount;
private TextView mTieCount;
private TextView mAndroidCount;
private int mHumanCounter = 0;
private int mTieCounter = 0;
private int mAndroidCounter = 0;
private boolean mHumanFirst = true;
private boolean mGameOver = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBoardButtons = new Button[mGame.getBOARD_SIZE()];
mBoardButtons[0] = (Button) findViewById(R.id.one);
mBoardButtons[1] = (Button) findViewById(R.id.two);
mBoardButtons[2] = (Button) findViewById(R.id.three);
mBoardButtons[3] = (Button) findViewById(R.id.four);
mBoardButtons[4] = (Button) findViewById(R.id.five);
mBoardButtons[5] = (Button) findViewById(R.id.six);
mBoardButtons[6] = (Button) findViewById(R.id.seven);
mBoardButtons[7] = (Button) findViewById(R.id.eight);
mBoardButtons[8] = (Button) findViewById(R.id.nine);
Button mTen = (Button) findViewById(R.id.ten);
mTen.setOnClickListener((OnClickListener) this);
Button mEleven = (Button) findViewById(R.id.eleven);
mEleven.setOnClickListener((OnClickListener) this);
mInfoTextView = (TextView) findViewById(R.id.information);
mHumanCount = (TextView) findViewById(R.id.humancount);
mTieCount = (TextView) findViewById(R.id.tiesCount);
mAndroidCount = (TextView) findViewById(R.id.androidCount);
mHumanCount.setText(Integer.toString(mHumanCounter));
mTieCount.setText(Integer.toString(mTieCounter));
mHumanCount.setText(Integer.toString(mAndroidCounter));
mGame = new TicTacToeGame();
startNewGame();
}
@Override
public void onClick(View v)
{
switch (v.getId())
{
case R.id.ten:
startNewGame();
break;
case R.id.eleven:
MainActivity.this.finish();
break;
}
}
private void startNewGame()
{
mGame.clearBoard();
for (int i = 0; i < mBoardButtons.length; i++)
{
mBoardButtons[i].setText("");
mBoardButtons[i].setEnabled(true);
mBoardButtons[i].setOnClickListener(new ButtonClickListener(i));
}
if (mHumanFirst)
{
mInfoTextView.setText(R.string.first_human);
mHumanFirst = false;
}
else
{
mInfoTextView.setText(R.string.turn_computer);
int move = mGame.getComputerMove();
setMove(mGame.ANDROID_PLAYER, move);
mHumanFirst = true;
}
}
private class ButtonClickListener implements View.OnClickListener
{
int location;
public ButtonClickListener(int location)
{
this.location = location;
}
public void onClick(View view)
{
if (!mGameOver)
{
if(mBoardButtons[location].isEnabled())
{
setMove(mGame.HUMAN_PLAYER, location);
int winner = mGame.checkForWinner();
if (winner == 0)
{
mInfoTextView.setText(R.string.turn_computer);
int move = mGame.getComputerMove();
setMove(mGame.ANDROID_PLAYER, move);
winner = mGame.checkForWinner();
}
if (winner == 0)
mInfoTextView.setText(R.string.turn_human);
else if (winner == 1)
{
mInfoTextView.setText(R.string.result_tie);
mTieCounter++;
mTieCount.setText(Integer.toString(mTieCounter));
mGameOver = true;
}
else if (winner ==2)
{
mInfoTextView.setText(R.string.result_human_wins);
mHumanCounter++;
mHumanCount.setText(Integer.toString(mHumanCounter));
mGameOver = true;
}
else if (winner ==3)
{
mInfoTextView.setText(R.string.result_android_wins);
mAndroidCounter++;
mAndroidCount.setText(Integer.toString(mAndroidCounter));
mGameOver = true;
}
}
}
}
}
private void setMove(char player, int location)
{
mGame.setMove(player,location);
mBoardButtons[location].setEnabled(false);
mBoardButtons[location].setText(String.valueOf(player));
if (player == mGame.HUMAN_PLAYER)
mBoardButtons[location].setTextColor(Color.GREEN);
else
{
mBoardButtons[location].setTextColor(Color.RED);
}
}
}
这是我的 strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">testjk</string>
<string name="hello_world">Hello world!</string>
<string name="turn_human">Jouw beurt.</string>
<string name="first_human">Jij mag eerst beginnen.</string>
<string name="turn_computer">computer is aan het nadenken</string>
<string name="result_tie">Gelijkspel!</string>
<string name="result_human_wins">net aan gewonnen!</string>
<string name="result_android_wins">sukkel!</string>
<string name="one">1</string>
<string name="two">2</string>
<string name="three">3</string>
<string name="four">4</string>
<string name="five">5</string>
<string name="six">6</string>
<string name="seven">7</string>
<string name="eight">8</string>
<string name="nine">9</string>
<string name="ten">nieuw spel</string>
<string name="eleven">stoppen</string>
<string name="info">Info</string>
<string name="human">JIJ: </string>
<string name="ties">Gelijkspel: </string>
<string name="android">Computer: </string>
<string name="contact_heading">Contact Informatie</string>
<string name="action_settings">Settings</string>
<string name="contact_info">
<b>Name:</b> Wouter\n
<b>Achternaam</b> de Jong\n
<b>Email</b> woutter@live.nl
</string>
<string name="about_heading">over </string>
<string name="TicTacToeGame">Boter Kaas en Eieren van wouter de jong</string>
</resources>
这是我的activity_main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="26dp"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.testjk.MainActivity" >
<TableLayout
android:id="@+id/PlayArea"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="10dp" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="clip_horizontal" >
<Button
android:id="@+id/one"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="@string/one"
android:textSize="70dp" />
<Button
android:id="@+id/two"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="@string/two"
android:textSize="70dp" />
<Button
android:id="@+id/three"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="@string/three"
android:textSize="70dp" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="clip_horizontal" >
<Button
android:id="@+id/four"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="@string/four"
android:textSize="70dp" />
<Button
android:id="@+id/five"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="@string/five"
android:textSize="70dp" />
<Button
android:id="@+id/six"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="@string/six"
android:textSize="70dp" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="clip_horizontal" >
<Button
android:id="@+id/seven"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="@string/seven"
android:textSize="70dp" />
<Button
android:id="@+id/eight"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="@string/eight"
android:textSize="70dp" />
<Button
android:id="@+id/nine"
android:layout_width="100dp"
android:layout_height="100dp"
android:text="@string/nine"
android:textSize="70dp" />
</TableRow>
</TableLayout>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/information"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal|clip_horizontal|fill_horizontal" >
<TextView
android:id="@+id/human"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/human" />
<TextView
android:id="@+id/humancount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp" />
<TextView
android:id="@+id/ties"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ties" />
<TextView
android:id="@+id/tiesCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp" />
<TextView
android:id="@+id/androidcount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/android" />
<TextView
android:id="@+id/androidCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</TableRow>
<TextView
android:id="@+id/information"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/PlayArea"
android:layout_below="@+id/PlayArea"
android:gravity="center"
android:text="@string/info"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/tableRow4"
android:layout_marginTop="32dp" >
<TableRow
android:id="@+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/ten"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:text="@string/ten" />
<Button
android:id="@+id/eleven"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="@string/eleven" />
</TableRow>
</TableLayout>
</RelativeLayout>
TicTacToeGame.java:
package com.example.testjk;
import java.util.Random;
public class TicTacToeGame {
private char mBoard[];
private final static int BOARD_SIZE = 9;
public static final char HUMAN_PLAYER = 'X';
public static final char ANDROID_PLAYER = '0';
public static final char EMPTY_SPACE = ' ';
private Random mRand;
public static int getBOARD_SIZE() {
return BOARD_SIZE;
}
public TicTacToeGame(){
mBoard = new char[BOARD_SIZE];
for (int i = 0; i < BOARD_SIZE; i++)
mBoard[i] = EMPTY_SPACE;
mRand = new Random();
}
public void clearBoard()
{
for (int i = 0;i < BOARD_SIZE; i++)
{
mBoard[i] = EMPTY_SPACE;
}
}
public void setMove(char player, int location)
{
mBoard[location] = player;
}
public int getComputerMove()
{
int move;
for (int i = 0; i < getBOARD_SIZE(); i++)
{
if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != ANDROID_PLAYER)
{
char curr = mBoard[i];
mBoard[i] = ANDROID_PLAYER;
if (checkForWinner() == 3)
{
setMove(ANDROID_PLAYER, i);
return i;
}
else
mBoard[i] = curr;
}
}
for (int i = 0; i < getBOARD_SIZE(); i++)
{
if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != ANDROID_PLAYER)
{
char curr = mBoard[i];
mBoard[i] = HUMAN_PLAYER;
if (checkForWinner() == 2)
{
setMove(ANDROID_PLAYER, i);
return i;
}
else
mBoard[i] = curr;
}
}
do
{
move = mRand.nextInt(getBOARD_SIZE());
}while (mBoard[move]==HUMAN_PLAYER || mBoard[move] == ANDROID_PLAYER);
setMove(ANDROID_PLAYER, move);
return move;
}
public int checkForWinner()
{
for (int i=0;i<=6;i+=3)
{
if (mBoard[i] == HUMAN_PLAYER &&
mBoard[i+1] == HUMAN_PLAYER &&
mBoard[i+2] == HUMAN_PLAYER)
return 2;
if (mBoard[i] == ANDROID_PLAYER &&
mBoard[i+1] == ANDROID_PLAYER &&
mBoard[i+2] == ANDROID_PLAYER)
return 3;
}
for (int i = 0; i <=2; i++)
{
if (mBoard[i] == HUMAN_PLAYER &&
mBoard[i+3] == HUMAN_PLAYER &&
mBoard[i+6] == HUMAN_PLAYER)
return 2;
if (mBoard[i] == ANDROID_PLAYER &&
mBoard[i+3] == ANDROID_PLAYER &&
mBoard[i+6] == ANDROID_PLAYER)
return 3;
}
if((mBoard[0] == HUMAN_PLAYER &&
mBoard[4] == HUMAN_PLAYER &&
mBoard[8] == HUMAN_PLAYER)||
(mBoard[2] == HUMAN_PLAYER &&
mBoard[4] == HUMAN_PLAYER &&
mBoard[6] == HUMAN_PLAYER))
return 2;
if((mBoard[0] == ANDROID_PLAYER &&
mBoard[4] == ANDROID_PLAYER &&
mBoard[8] == ANDROID_PLAYER)||
(mBoard[2] == ANDROID_PLAYER &&
mBoard[4] == ANDROID_PLAYER &&
mBoard[6] == ANDROID_PLAYER))
return 3;
for (int i = 0; i < getBOARD_SIZE(); i++)
{
if (mBoard[i] != HUMAN_PLAYER && mBoard[i] != ANDROID_PLAYER)
return 0;
}
return 1;
}
}
我的 bin/res 文件夹中的 AndroidManiFest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.testjk"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_hoi"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
game_menu.xml 在我的 res/menu 文件夹中:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
</menu>
这些是我编辑的所有类(class)。这是我得到的 logcat:/image/vP6De.png
最佳答案
package com.example.testjk;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity implements OnClickListener{
private TicTacToeGame mGame;
private Button mBoardButtons[];
private TextView mInfoTextView;
private TextView mHumanCount;
private TextView mTieCount;
private TextView mAndroidCount;
private int mHumanCounter = 0;
private int mTieCounter = 0;
private int mAndroidCounter = 0;
private boolean mHumanFirst = true;
private boolean mGameOver = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBoardButtons = new Button[mGame.getBOARD_SIZE()];
mBoardButtons[0] = (Button) findViewById(R.id.one);
mBoardButtons[1] = (Button) findViewById(R.id.two);
mBoardButtons[2] = (Button) findViewById(R.id.three);
mBoardButtons[3] = (Button) findViewById(R.id.four);
mBoardButtons[4] = (Button) findViewById(R.id.five);
mBoardButtons[5] = (Button) findViewById(R.id.six);
mBoardButtons[6] = (Button) findViewById(R.id.seven);
mBoardButtons[7] = (Button) findViewById(R.id.eight);
mBoardButtons[8] = (Button) findViewById(R.id.nine);
Button mTen = (Button) findViewById(R.id.ten);
mTen.setOnClickListener((OnClickListener) this);
Button mEleven = (Button) findViewById(R.id.eleven);
mEleven.setOnClickListener((OnClickListener) this);
mInfoTextView = (TextView) findViewById(R.id.information);
mHumanCount = (TextView) findViewById(R.id.humancount);
mTieCount = (TextView) findViewById(R.id.tiesCount);
mAndroidCount = (TextView) findViewById(R.id.androidCount);
mHumanCount.setText(Integer.toString(mHumanCounter));
mTieCount.setText(Integer.toString(mTieCounter));
mHumanCount.setText(Integer.toString(mAndroidCounter));
mGame = new TicTacToeGame();
startNewGame();
}
@Override
public void onClick(View v)
{
switch (v.getId())
{
case R.id.ten:
startNewGame();
break;
case R.id.eleven:
MainActivity.this.finish();
break;
}
}
private void startNewGame()
{
mGame.clearBoard();
for (int i = 0; i < mBoardButtons.length; i++)
{
mBoardButtons[i].setText("");
mBoardButtons[i].setEnabled(true);
mBoardButtons[i].setOnClickListener(new ButtonClickListener(i));
}
if (mHumanFirst)
{
mInfoTextView.setText(R.string.first_human);
mHumanFirst = false;
}
else
{
mInfoTextView.setText(R.string.turn_computer);
int move = mGame.getComputerMove();
setMove(mGame.ANDROID_PLAYER, move);
mHumanFirst = true;
}
}
private class ButtonClickListener implements View.OnClickListener
{
int location;
public ButtonClickListener(int location)
{
this.location = location;
}
public void onClick(View view)
{
if (!mGameOver)
{
if(mBoardButtons[location].isEnabled())
{
setMove(mGame.HUMAN_PLAYER, location);
int winner = mGame.checkForWinner();
if (winner == 0)
{
mInfoTextView.setText(R.string.turn_computer);
int move = mGame.getComputerMove();
setMove(mGame.ANDROID_PLAYER, move);
winner = mGame.checkForWinner();
}
if (winner == 0)
mInfoTextView.setText(R.string.turn_human);
else if (winner == 1)
{
mInfoTextView.setText(R.string.result_tie);
mTieCounter++;
mTieCount.setText(Integer.toString(mTieCounter));
mGameOver = true;
}
else if (winner ==2)
{
mInfoTextView.setText(R.string.result_human_wins);
mHumanCounter++;
mHumanCount.setText(Integer.toString(mHumanCounter));
mGameOver = true;
}
else if (winner ==3)
{
mInfoTextView.setText(R.string.result_android_wins);
mAndroidCounter++;
mAndroidCount.setText(Integer.toString(mAndroidCounter));
mGameOver = true;
}
}
}
}
}
private void setMove(char player, int location)
{
mGame.setMove(player,location);
mBoardButtons[location].setEnabled(false);
mBoardButtons[location].setText(String.valueOf(player));
if (player == mGame.HUMAN_PLAYER)
mBoardButtons[location].setTextColor(Color.GREEN);
else
{
mBoardButtons[location].setTextColor(Color.RED);
}
}
}
它在这里工作,因为我不使用appcompact 7进行开发,我使用 Activity 来扩展你的类,并且我也没有使用你的menu.xml,首先删除该文件并尝试构建你的代码,如果这不起作用使用这个文件在我这边工作正常,游戏重新启动和应用程序关闭也可以。谢谢 使用这个并在出现任何问题时返回。在这里查看它的工作
关于java - 我的应用程序在启动时停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26894869/
我是 C 语言新手,我编写了这个 C 程序,让用户输入一年中的某一天,作为返回,程序将输出月份以及该月的哪一天。该程序运行良好,但我现在想简化该程序。我知道我需要一个循环,但我不知道如何去做。这是程序
我一直在努力找出我的代码有什么问题。这个想法是创建一个小的画图程序,并有红色、绿色、蓝色和清除按钮。我有我能想到的一切让它工作,但无法弄清楚代码有什么问题。程序打开,然后立即关闭。 import ja
我想安装screen,但是接下来我应该做什么? $ brew search screen imgur-screenshot screen
我有一个在服务器端工作的 UDP 套接字应用程序。为了测试服务器端,我编写了一个简单的 python 客户端程序,它发送消息“hello world how are you”。服务器随后应接收消息,将
我有一个 shell 脚本,它运行一个 Python 程序来预处理一些数据,然后运行一个 R 程序来执行一些长时间运行的任务。我正在学习使用 Docker 并且我一直在运行 FROM r-base:l
在 Linux 中。我有一个 c 程序,它读取一个 2048 字节的文本文件作为输入。我想从 Python 脚本启动 c 程序。我希望 Python 脚本将文本字符串作为参数传递给 c 程序,而不是将
对于一个类,我被要求编写一个 VHDL 程序,该程序接受两个整数输入 A 和 B,并用 A+B 替换 A,用 A-B 替换 B。我编写了以下程序和测试平台。它完成了实现和行为语法检查,但它不会模拟。尽
module Algorithm where import System.Random import Data.Maybe import Data.List type Atom = String ty
我想找到两个以上数字的最小公倍数 求给定N个数的最小公倍数的C++程序 最佳答案 int lcm(int a, int b) { return (a/gcd(a,b))*b; } 对于gcd,请查看
这个程序有错误。谁能解决这个问题? Error is :TempRecord already defines a member called 'this' with the same paramete
当我运行下面的程序时,我在 str1 和 str2 中得到了垃圾值。所以 #include #include #include using namespace std; int main() {
这是我的作业: 一对刚出生的兔子(一公一母)被放在田里。兔子在一个月大时可以交配,因此在第二个月的月底,每对兔子都会生出两对新兔子,然后死去。 注:在第0个月,有0对兔子。第 1 个月,有 1 对兔子
我编写了一个程序,通过对字母使用 switch 命令将十进制字符串转换为十六进制,但是如果我使用 char,该程序无法正常工作!没有 switch 我无法处理 9 以上的数字。我希望你能理解我,因为我
我是 C++ 新手(虽然我有一些 C 语言经验)和 MySQL,我正在尝试制作一个从 MySQL 读取数据库的程序,我一直在关注这个 tutorial但当我尝试“构建”解决方案时出现错误。 (我正在使
仍然是一个初学者,只是尝试使用 swift 中的一些基本函数。 有人能告诉我这段代码有什么问题吗? import UIKit var guessInt: Int var randomNum = arc
我正在用 C++11 编写一个函数,它采用 constant1 + constant2 形式的表达式并将它们折叠起来。 constant1 和 constant2 存储在 std::string 中,
我用 C++ 编写了这段代码,使用运算符重载对 2 个矩阵进行加法和乘法运算。当我执行代码时,它会在第 57 行和第 59 行产生错误,非法结构操作(两行都出现相同的错误)。请解释我的错误。提前致谢:
我是 C++ 的初学者,我想编写一个简单的程序来交换字符串中的两个字符。 例如;我们输入这个字符串:“EXAMPLE”,我们给它交换这两个字符:“E”和“A”,输出应该类似于“AXEMPLA”。 我在
我需要以下代码的帮助: 声明 3 个 double 类型变量,每个代表三角形的三个边中的一个。 提示用户为第一面输入一个值,然后 将用户的输入设置为您创建的代表三角形第一条边的变量。 将最后 2 个步
我是新来的,如果问题不好请见谅 任务:将给定矩阵旋转180度 输入: 1 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 输出: 16 15 14 13 12 11
我是一名优秀的程序员,十分优秀!