關於pta三次作業的總結

来源:https://www.cnblogs.com/hjjhjy/p/18147634
-Advertisement-
Play Games

oop三次pta總結 前言 在這學期的java課程學習當中,我已經體會到了java這門語言的重要性了,就從這三次pta題目的設計與思路來說吧(還真的有點小難),特別是每一期pta的最後一題...... 《答題判題程式》,這道題目依次迭代,難度依次上升(如果沒有設計好,基本是寄了),題目不多看幾遍細節 ...


oop三次pta總結

前言

在這學期的java課程學習當中,我已經體會到了java這門語言的重要性了,就從這三次pta題目的設計與思路來說吧(還真的有點小難),特別是每一期pta的最後一題......

答題判題程式》,這道題目依次迭代,難度依次上升(如果沒有設計好,基本是寄了),題目不多看幾遍細節是真的不能把握,如果細節忽略了,那就要付出幾倍的時間和

去修正了。(別問我怎麼知道的)

這道題目涵蓋正則表達式類的設計,等知識點。從複雜到更複雜,時間耗費的越來越多,(一個測試點一天)

接下來一題一題來分析看看吧,也總結一下自己的代碼設計錯誤

 

設計與分析

題目1:

設計實現答題程式,模擬一個小型的測試,要求輸入題目信息和答題信息,根據輸入題目信息中的標準答案判斷答題的結果。

輸入格式:

程式輸入信息分三部分:


1、題目數量

   格式:整數數值,若超過1位最高位不能為0,

   樣例:34

2、題目內容

   一行為一道題,可以輸入多行數據。

   格式:"#N:"+題號+" "+"#Q:"+題目內容+" "#A:"+標準答案

格式約束:題目的輸入順序與題號不相關,不一定按題號順序從小到大輸入。

   樣例:#N:1 #Q:1+1= #A:2

         #N:2 #Q:2+2= #A:4

3、答題信息

   答題信息按行輸入,每一行為一組答案,每組答案包含第2部分所有題目的解題答案,答案的順序號與題目題號相對應。

   格式:"#A:"+答案內容

   格式約束:答案數量與第2部分題目的數量相同,答案之間以英文空格分隔。

   樣例:#A:2 #A:78

      2是題號為1的題目的答案
      78是題號為2的題目的答案

   答題信息以一行"end"標記結束,"end"之後的信息忽略。

輸出格式:

1、題目數量

   格式:整數數值,若超過1位最高位不能為0,

   樣例:34

2、答題信息

   一行為一道題的答題信息,根據題目的數量輸出多行數據。

   格式:題目內容+" ~"+答案

   樣例:1+1=~2

          2+2= ~4

3、判題信息

   判題信息為一行數據,一條答題記錄每個答案的判斷結果,答案的先後順序與題目題號相對應。

   格式:判題結果+" "+判題結果

   格式約束:

     1、判題結果輸出只能是true或者false,
     2、判題信息的順序與輸入答題信息中的順序相同

   樣例:true false true

代碼:

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int number;
        number = sc.nextInt();
        Answerpaper answerpaper[] = new Answerpaper[2 * number + 1];
        int[] num = new int[number + 1];
        String str;
        sc.nextLine();
        String[][] Str = new String[number + 2][];
        for (int i = 1; i <= number + 1; i++) {
            str = sc.nextLine();
            Str[i] = str.split(":");
            for (int j = 1; j < Str[i].length; j++) {
                while (Str[i][j].charAt(0) == ' ') {
                    Str[i][j] = Str[i][j].substring(1);
                }
                if (i == number + 1) {
                    while (Str[i][j].charAt(Str[i][j].length() - 1) == '#' ||
                            Str[i][j].charAt(Str[i][j].length() - 1) == 'A' ||
                            Str[i][j].charAt(Str[i][j].length() - 1) == ' ') {
                        Str[i][j] = Str[i][j].substring(0, Str[i][j].length() - 1);
                    }
                }
                if (j == 1 && i != number + 1) {
                    while (Str[i][j].charAt(Str[i][j].length() - 1) == '#' ||
                            Str[i][j].charAt(Str[i][j].length() - 1) == 'Q' ||
                            Str[i][j].charAt(Str[i][j].length() - 1) == ' ') {
                        Str[i][j] = Str[i][j].substring(0, Str[i][j].length() - 1);
                    }
                    num[i] = 0;
                    for (int k = 0; k < Str[i][j].length(); k++)
                        num[i] += ((int) Str[i][j].charAt(k) - 48) * Math.pow(10, Str[i][j].length() - k - 1);

                }
                if (j == 2 && i != number + 1) {
                    Str[i][j] = Str[i][j].substring(0, Str[i][j].length() - 1);
                    Str[i][j] = Str[i][j].substring(0, Str[i][j].length() - 1);
                    while (Str[i][j].charAt(Str[i][j].length() - 1) == ' ') {
                        Str[i][j] = Str[i][j].substring(0, Str[i][j].length() - 1);
                    }
                }
                if (j == 3) {
                    while (Str[i][j].charAt(Str[i][j].length() - 1) == ' ') {
                        Str[i][j] = Str[i][j].substring(0, Str[i][j].length() - 1);
                    }
                }
            }

        }

        for (int i = 1; i <= number; i++) {
            answerpaper[num[i]] = new Answerpaper(number, num[i], Str[1 + number][num[i]], Str[i][3], Str[i][2]);
        }
        for (int i = 1; i <= number; i++) {
            for (int j = 1; j <= number - 1; j++) {
                if (num[j] > num[j + 1]) {
                    int a = num[j + 1];
                    num[j + 1] = num[j];
                    num[j] = a;
                }
            }
        }
        for (int i = 1; i <= number; i++) {
            answerpaper[num[i]].printlnof();
            answerpaper[num[i]].printresult();
        }
        for (int i = 1; i <= number; i++) {
            if (answerpaper[num[i]].paper.problem.answerright(answerpaper[num[i]])) {
                if (i != number) {
                    System.out.printf("true ");
                } else {
                    System.out.printf("true");
                }

            } else {
                if (i != number)
                    System.out.printf("false ");
                else
                    System.out.printf("false");
            }
        }
    }
}

class Problem {
    int num;
    String content;
    String standardAnswer;

    public Problem(int num, String content, String standardAnswer) {
        this.num = num;
        this.content = content;
        this.standardAnswer = standardAnswer;
    }

    public boolean answerright(Answerpaper answerpaper) {
        if (answerpaper.answer.equals(standardAnswer))
            return true;
        return false;
    }
}

class Paper {
    Problem problem;
    int number;

    public Paper(int number, String standardAnswer, int num, String content) {
        problem = new Problem(num, content, standardAnswer);
        this.number = number;
    }

    public Problem getProblem() {
        return this.problem;
    }
}

class Answerpaper {
    Paper paper;
    static int num = 0;
    String answer;
    private boolean result;

    public Answerpaper(int number, int num, String standardAnswer, String answer, String content) {
        this.answer = answer;
        paper = new Paper(number, standardAnswer, num, content);
    }

    public boolean numjudgeAnswer(int num) {
        return true;
    }

    public void printlnof() {
        System.out.printf("%s", paper.getProblem().content);
    }

    public void printresult() {
        System.out.printf("~%s\n", paper.getProblem().standardAnswer);
    }
}
    

 

 我的基本思路是將輸入的問題,試卷,答卷分割成各個部分,並儲存進Answerpaper類。Answerpaper類中有paper類,paper類中有problem類儲存題目,這樣一來就可通過引用答卷類從而對答卷上的答題信息進行正誤的判斷,將三種信息很好的關聯了起來,我為了分割字元串還在"main"函數中定義了一個二維字元串數組。。。而我分割輸入就是通過"N","S","T"來判斷輸入是問題還是試卷還是答卷。再使用split()和substring函數從而做到將多餘的字元去掉從而得到需要的

看上去我對類的設計非常不錯,三個類分的很好,但是但是我類中的變數都不是private(私有的),從而很嚴重的破壞了類的封裝性。主要是當時也為了圖方便,想著直接引用就行了,還不用寫getter方法 ,但是卻忘了最重要的類的封裝性。

還有就是我在主方法裡面分割字元串(還分割的很複雜),主方法裡面就只能做兩件事就是輸入輸出,但是我卻在主方法裡面做了別的事,這是不可取得

然後就是我沒有用正則表達式(最簡便得方法),正則表達式我竟然學了沒用,本來這道題就是考察正則表達式的。嘆。。。(無力感)

 

 額,這裡Main函數是紅色,因為字元串的分割全在Main函數中,要加一個splitinput類去解決這個問題。

 

 啊,這個Main函數實在是太複雜了呀,二維的字元串數組真的是太複雜了,所以一定要有一個splitinput類去解決問題,而且要使用正則表達式啊,這真的是廢物代碼啊。連複雜度為6的代碼都有,真的需要去好好改進。所以第一次代碼簡直跟寫C語言一樣(沒有可讀性

 

題目2:

設計實現答題程式,模擬一個小型的測試,以下粗體字顯示的是在答題判題程式-1基礎上增補或者修改的內容。

要求輸入題目信息、試卷信息和答題信息,根據輸入題目信息中的標準答案判斷答題的結果。

輸入格式:

程式輸入信息分三種,三種信息可能會打亂順序混合輸入:

1、題目信息

   一行為一道題,可輸入多行數據(多道題)。

   格式:"#N:"+題目編號+" "+"#Q:"+題目內容+" "#A:"+標準答案

格式約束:

    1、題目的輸入順序與題號不相關,不一定按題號順序從小到大輸入。
    2、允許題目編號有缺失,例如:所有輸入的題號為1、2、5,缺少其中的3號題。此種情況視為正常。

   樣例:#N:1 #Q:1+1= #A:2

         #N:2 #Q:2+2= #A:4

2、試卷信息

一行為一張試卷,可輸入多行數據(多張捲)。

格式:"#T:"+試卷號+" "+題目編號+"-"+題目分值

     題目編號應與題目信息中的編號對應。

     一行信息中可有多項題目編號與分值。

樣例:#T:1 3-5 4-8 5-2

3、答卷信息

    答卷信息按行輸入,每一行為一張答卷的答案,每組答案包含某個試卷信息中的題目的解題答案,答案的順序與試卷信息中的題目順序相對應。

   格式:"#S:"+試卷號+" "+"#A:"+答案內容

   格式約束:答案數量可以不等於試卷信息中題目的數量,沒有答案的題目計0分,多餘的答案直接忽略,答案之間以英文空格分隔。

   樣例:#S:1 #A:5 #A:22

       1是試卷號 

       5是1號試卷的順序第1題的題目答案

       22是1號試卷的順序第2題的題目答案

   答題信息以一行"end"標記結束,"end"之後的信息忽略。

輸出格式:

1、試卷總分警示

該部分僅當一張試卷的總分分值不等於100分時作提示之用,試卷依然屬於正常試卷,可用於後面的答題。如果總分等於100分,該部分忽略,不輸出。

   格式:"alert: full score of test paper"+試卷號+" is not 100 points"

   樣例:alert: full score of test paper2 is not 100 points

2、答卷信息

   一行為一道題的答題信息,根據試卷的題目的數量輸出多行數據。

   格式:題目內容+"~"+答案++"~"+判題結果(true/false)

約束:如果輸入的答案信息少於試卷的題目數量,答案的題目要輸"answer is null"   

樣例:   3+2=~5~true

         4+6=~22~false.

      answer is null

3、判分信息

   判分信息為一行數據,是一條答題記錄所對應試卷的每道小題的計分以及總分,計分輸出的先後順序與題目題號相對應。

   格式:題目得分+" "+....+題目得分+"~"+總分

   格式約束:

 1、沒有輸入答案的題目計0分

 2、判題信息的順序與輸入答題信息中的順序相同
 

   樣例:5 8 0~13

根據輸入的答卷的數量以上2、3項答卷信息與判分信息將重覆輸出。

4、提示錯誤的試卷號

如果答案信息中試卷的編號找不到,則輸出”the test paper number does not exist”,參見樣例9。

 

設計建議:

參考答題判題程式-1,建議增加答題類,類的內容以及類之間的關聯自行設計。

代碼:

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Question question = new Question();
        ScoreSumJudge scoresumjudge = new ScoreSumJudge();
        AnswerQuestion answerquestion = new AnswerQuestion();
        SplitInput splitinput = new SplitInput();
        int QuestionSum = 0, PaperSum = 0, AnswerSum = 0;
        String input[] = new String[100];
        for (int i = 1; i < i + 1; i++) {
            input[i] = sc.nextLine();
            if (input[i].equals("end"))
                break;
        }
        int i = 1;
        while (!(input[i].equals("end"))) {
            splitinput.setInput(input[i]);
            if (input[i].charAt(1) == 'N') {
                splitinput.splitQuestion();
                if (splitinput.getQuestionNum() > QuestionSum) {
                    QuestionSum = splitinput.getQuestionNum();
                }
                question.setQuestion(QuestionSum, splitinput.getQuestionNum(), splitinput.getQuestion(), splitinput.getStandardAnswer());

            }
            i++;
        }
        i = 1;
        while (!(input[i].equals("end"))) {
            splitinput.setInput(input[i]);
            if (input[i].charAt(1) == 'T') {
                splitinput.splitPaper();
                if (splitinput.getPaperNum() > PaperSum) {
                    PaperSum = splitinput.getPaperNum();
                }
                scoresumjudge.setScore(PaperSum, splitinput.getPaperNum(), splitinput.getPaperQuestionNum(), splitinput.getPaperQuestionMark());
                answerquestion.setPaper(PaperSum, splitinput.getPaperNum());
                answerquestion.getPaper()[splitinput.getPaperNum()].setPaper(splitinput.getPaperQuestionSum(), splitinput.getPaperQuestionNum(), splitinput.getPaperQuestionMark(), question);
            }
            i++;
        }
        scoresumjudge.printResult();
        i = 1;
        while (!(input[i].equals("end"))) {
            splitinput.setInput(input[i]);
            if (input[i].charAt(1) == 'S') {
                splitinput.splitAnswer();
                if (splitinput.getAnswerPaperNum() > AnswerSum) {
                    AnswerSum = splitinput.getAnswerPaperNum();
                }
                answerquestion.setAnswerPaper(AnswerSum, splitinput.getAnswerPaperNum());
                answerquestion.getAnswerPaper()[splitinput.getAnswerPaperNum()].setAnswerPaper(splitinput.getAnswer());
                for (int k = 1; k <= answerquestion.getPaperSum(); k++) {
                    if (k == splitinput.getAnswerPaperNum()) {
                        answerquestion.judge(splitinput.getAnswerPaperNum(), question);
                        break;
                    }
                    if (k == answerquestion.getPaperSum()) {
                        System.out.println("The test paper number does not exist");
                        break;
                    }
                }
            }
            i++;
        }
    }
}

class judge {
    AnswerQuestion answerQuestion = new AnswerQuestion();
    Question question = new Question();

    public judge() {

    }

    public judge(AnswerQuestion answerQuestion, Question question) {
        this.answerQuestion = answerQuestion;
        this.question = question;
    }

}

class SplitInput {
    private String Question;
    private String QuestionNum;
    private String StandardAnswer;
    private String Questionmark;
    private String input;
    private int PaperQuestionSum;
    private int AnswerPaperNum;
    private String[] Answer;
    private String PaperNum;
    private int[] PaperQuestionNum;
    private int[] PaperQuestionMark;

    public SplitInput() {

    }

    public SplitInput(String input) {
        this.input = input;
    }

    public void setInput(String input) {
        this.input = input;
    }

    public void splitQuestion() {
        input = input.replaceAll(" #A", "");
        String s[] = input.split(":");
        while (s[1].charAt(s[1].length() - 1) == ' ' || s[1].charAt(s[1].length() - 1) == '#' || s[1].charAt(s[1].length() - 1) == 'Q') {
            s[1] = s[1].substring(0, s[1].length() - 1);
        }
        while (s[2].charAt(s[2].length() - 1) == ' ' || s[2].charAt(s[2].length() - 1) == '#' || s[2].charAt(s[2].length() - 1) == 'A') {
            s[2] = s[2].substring(0, s[2].length() - 1);
        }
        this.QuestionNum = s[1];
        this.Question = s[2];
        this.StandardAnswer = s[3];
    }

    public void splitPaper() {
        input = input.replaceAll("#T:", "");
        input = input.replaceAll("#A:", "");
        input = input.replaceAll("#Q:", "");
        String[] s = input.split("\\s+");
        PaperQuestionNum = new int[s.length];
        PaperQuestionMark = new int[s.length];
        PaperNum = s[0];
        PaperQuestionSum = s.length - 1;
        for (int i = 1; i < s.length; i++) {
            String[] ss = s[i].split("-");
            PaperQuestionNum[i] = Integer.parseInt(ss[0]);
            PaperQuestionMark[i] = Integer.parseInt(ss[1]);
        }
    }

    public void splitAnswer() {
        input = input.replaceAll("#S:", "");
        input = input.replaceAll("#A:", "");
        String[] s = input.split("\\s+");
        this.AnswerPaperNum = Integer.parseInt(s[0]);
        this.Answer = new String[s.length];
        for (int i = 1; i < s.length; i++) {
            this.Answer[i] = s[i];
        }
    }

    public int getQuestionNum() {
        return Integer.parseInt(this.QuestionNum);
    }

    public String getQuestion() {
        return this.Question;
    }

    public String getStandardAnswer() {
        return this.StandardAnswer;
    }

    public int getPaperQuestionSum() {
        return PaperQuestionSum;
    }

    public int getPaperNum() {
        return Integer.parseInt(this.PaperNum);
    }

    public int[] getPaperQuestionNum() {
        return this.PaperQuestionNum;
    }

    public int[] getPaperQuestionMark() {
        return this.PaperQuestionMark;
    }

    public int getAnswerPaperNum() {
        return this.AnswerPaperNum;
    }

    public String[] getAnswer() {
        return this.Answer;
    }
}

class ScoreSumJudge {
    private int MarkSum;
    private int PaperSum = 0;
    private String result[] = new String[PaperSum + 1];
    private int PaperQuestionNum[] = new int[PaperSum + 1];
    private int score[] = new int[PaperSum + 1];

    public ScoreSumJudge() {

    }

    public void upDate() {
        String result2[] = new String[PaperSum + 1];
        for (int i = 1; i < this.result.length; i++) {
            result2[i] = result[i];
        }
        result = new String[PaperSum];
        result = result2;
    }

    public void setScore(int PaperSum, int PaperNum, int[] PaperQuestionNum, int[] PaperQuestionMark) {
        this.PaperSum = PaperSum;
        this.MarkSum = 0;
        this.upDate();
        for (int i = 1; i < PaperQuestionNum.length; i++) {
            MarkSum += PaperQuestionMark[i];
        }
        if (MarkSum != 100)
            result[PaperNum] = "alert: full score of test paper" + PaperNum + " is not 100 points";
        else
            result[PaperNum] = "";
    }

    public void printResult() {
        for (int i = 1; i < result.length; i++) {
            if (!(result[i].equals(""))) {
                System.out.println(result[i]);
            }
        }
    }
}

class AnswerQuestion {
    private int AnswerSum = 0;
    private int PaperSum = 0;
    AnswerPaper answerPaper[] = new AnswerPaper[AnswerSum + 1];
    Paper paper[] = new Paper[PaperSum + 1];

    public AnswerQuestion() {

    }

    public int getPaperSum() {
        return this.PaperSum;
    }

    public int getAnswerSum() {
        return this.PaperSum;
    }

    public void upDatePaper() {
        Paper paper2[] = new Paper[PaperSum + 1];
        for (int i = 1; i < paper.length; i++) {
            paper2[i] = paper[i];
        }
        this.paper = new Paper[PaperSum + 1];
        this.paper = paper2;
    }

    public void upDateAnswerPaper() {
        AnswerPaper answerPaper2[] = new AnswerPaper[AnswerSum + 1];
        for (int i = 1; i < answerPaper.length; i++) {
            answerPaper2[i] = answerPaper[i];
        }
        answerPaper = new AnswerPaper[AnswerSum + 1];
        answerPaper = answerPaper2;
    }

    public void setPaper(int PaperSum, int PaperNum) {
        this.PaperSum = PaperSum;
        this.upDatePaper();
        paper[PaperNum] = new Paper();
    }

    public void judge(int AnswerNum, Question question) {
        int mark = 0;
        if (this.getAnswerPaper()[AnswerNum].getAnswer().length - 1 == this.getPaper()[AnswerNum].getPaperSum()) {
            for (int i = 1; i <= this.getPaper()[AnswerNum].getPaperSum(); i++) {
                if (this.getAnswerPaper()[AnswerNum].getAnswer()[i].equals(question.getStandardAnswer()[this.getPaper()[AnswerNum].getPaperQuestionNum()[i]])) {
                    System.out.println(question.getQuestion()[this.getPaper()[AnswerNum].getPaperQuestionNum()[i]] + "~" + this.getAnswerPaper()[AnswerNum].getAnswer()[i] + "~" + "true");
                    mark += this.getPaper()[AnswerNum].getPaperQuestionMark()[i];
                } else {
                    System.out.println(question.getQuestion()[this.getPaper()[AnswerNum].getPaperQuestionNum()[i]] + "~" + this.getAnswerPaper()[AnswerNum].getAnswer()[i] + "~" + "false");

                }
            }
            for (int i = 1; i <= this.getPaper()[AnswerNum].getPaperSum(); i++) {
                if (this.getAnswerPaper()[AnswerNum].getAnswer()[i].equals(question.getStandardAnswer()[this.getPaper()[AnswerNum].getPaperQuestionNum()[i]])) {
                    if (i == this.getPaper()[AnswerNum].getPaperSum())
                        System.out.printf("%s~", this.getPaper()[AnswerNum].getPaperQuestionMark()[i]);
                    else
                        System.out.printf("%s ", this.getPaper()[AnswerNum].getPaperQuestionMark()[i]);
                } else	   

您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 本文介紹基於Python語言中ArcPy模塊,實現ArcMap自動批量出圖,並對地圖要素進行自定義批量設置的方法。 1 任務需求 首先,我們來明確一下本文所需實現的需求。 現有通過Python基於Excel數據加以反距離加權空間插值並掩膜圖層所繪製的北京市在2019年05月18日00時至23時(其中 ...
  • 1. OSI 7層模型 OSI的7層模型對於大家來說可能不太好理解,所以我們通過一個案例來講解: 假設,你在瀏覽器上輸入了一些關鍵字,內部通過DNS找到對應的IP後,再發送數據時內部會做如下的事: 應用層:規定數據的格式。 "GET /s?wd=你好 HTTP/1.1\r\nHost:www.bai ...
  • 前言 整理這個官方翻譯的系列,原因是網上大部分的 tomcat 版本比較舊,此版本為 v11 最新的版本。 開源項目 從零手寫實現 tomcat minicat 別稱【嗅虎】心有猛虎,輕嗅薔薇。 系列文章 web server apache tomcat11-01-官方文檔入門介紹 web serv ...
  • 目錄1. #include <stdio.h>2.int 整形數據類型3.main 函數4.printf 函數5.return 函數6.”{}”與“;” “Hellow world!"是初學者的第一份代碼,可以說所學萬物代碼之基礎。下麵看一下代碼是如何實現的: 代碼雖然簡潔,但是包含了許多C語言的知 ...
  • Python的下載安裝和環境搭建,以及python的IDE工具PyCharm搭建及常用配置教程,可以讓新人快速上手python的使用。 ...
  • 以下是個人總結的Java常用的十大開源工具類庫,根據具體需求和項目,可以選擇合適的工具類庫來提高開發效率。1. Apache Commons:Apache Commons是一個開源的工具類庫,提供了大量常用的工具類和組件,如StringUtils、IOUtils、CollectionUtils等。2 ...
  • 1.為什麼使用索引 索引是存儲引擎用於快速找到數據記錄的一種數據結構,就好比一本書的目錄部分,通過目錄中找到對應文章的頁碼,便可快速定位到需要的文章。MySQL中的索引也是一樣的道理,進行數據查找時,首先查看查詢條件是否命中某條索引,符合則通過索引查找相關數據,如果不符合則需要全表掃描,即需要一條條 ...
  • 1.前言: 第一次作業難度較大,從無到有的設計,涉及到的主要類有Paper,Question,AnswerPaper,Main,主要題目方向為字元串判斷與字元串處理(提取有效信息),判斷對錯算總分,配合一些Java自帶的數據結構如ArrayList即可快速解決問題,第一次作業是後面作業的基礎,需自行 ...
一周排行
    -Advertisement-
    Play Games
  • 概述:本文代碼示例演示瞭如何在WPF中使用LiveCharts庫創建動態條形圖。通過創建數據模型、ViewModel和在XAML中使用`CartesianChart`控制項,你可以輕鬆實現圖表的數據綁定和動態更新。我將通過清晰的步驟指南包括詳細的中文註釋,幫助你快速理解並應用這一功能。 先上效果: 在 ...
  • openGauss(GaussDB ) openGauss是一款全面友好開放,攜手伙伴共同打造的企業級開源關係型資料庫。openGauss採用木蘭寬鬆許可證v2發行,提供面向多核架構的極致性能、全鏈路的業務、數據安全、基於AI的調優和高效運維的能力。openGauss深度融合華為在資料庫領域多年的研 ...
  • openGauss(GaussDB ) openGauss是一款全面友好開放,攜手伙伴共同打造的企業級開源關係型資料庫。openGauss採用木蘭寬鬆許可證v2發行,提供面向多核架構的極致性能、全鏈路的業務、數據安全、基於AI的調優和高效運維的能力。openGauss深度融合華為在資料庫領域多年的研 ...
  • 概述:本示例演示了在WPF應用程式中實現多語言支持的詳細步驟。通過資源字典和數據綁定,以及使用語言管理器類,應用程式能夠在運行時動態切換語言。這種方法使得多語言支持更加靈活,便於維護,同時提供清晰的代碼結構。 在WPF中實現多語言的一種常見方法是使用資源字典和數據綁定。以下是一個詳細的步驟和示例源代 ...
  • 描述(做一個簡單的記錄): 事件(event)的本質是一個委托;(聲明一個事件: public event TestDelegate eventTest;) 委托(delegate)可以理解為一個符合某種簽名的方法類型;比如:TestDelegate委托的返回數據類型為string,參數為 int和 ...
  • 1、AOT適合場景 Aot適合工具類型的項目使用,優點禁止反編 ,第一次啟動快,業務型項目或者反射多的項目不適合用AOT AOT更新記錄: 實實在在經過實踐的AOT ORM 5.1.4.117 +支持AOT 5.1.4.123 +支持CodeFirst和非同步方法 5.1.4.129-preview1 ...
  • 總說周知,UWP 是運行在沙盒裡面的,所有許可權都有嚴格限制,和沙盒外交互也需要特殊的通道,所以從根本杜絕了 UWP 毒瘤的存在。但是實際上 UWP 只是一個應用模型,本身是沒有什麼許可權管理的,許可權管理全靠 App Container 沙盒控制,如果我們脫離了這個沙盒,UWP 就會放飛自我了。那麼有沒... ...
  • 目錄條款17:讓介面容易被正確使用,不易被誤用(Make interfaces easy to use correctly and hard to use incorrectly)限制類型和值規定能做和不能做的事提供行為一致的介面條款19:設計class猶如設計type(Treat class de ...
  • title: 從零開始:Django項目的創建與配置指南 date: 2024/5/2 18:29:33 updated: 2024/5/2 18:29:33 categories: 後端開發 tags: Django WebDev Python ORM Security Deployment Op ...
  • 1、BOM對象 BOM:Broswer object model,即瀏覽器提供我們開發者在javascript用於操作瀏覽器的對象。 1.1、window對象 視窗方法 // BOM Browser object model 瀏覽器對象模型 // js中最大的一個對象.整個瀏覽器視窗出現的所有東西都 ...