小编PNC*_*PNC的帖子

使用数组上的字符串切换语句

#include<stdio.h>

int main(){

    char name[20];

    printf("enter a name ");
    scanf("%s",name);
    switch(name[20]){
        case "kevin" : 
        printf("hello");
        break;
    }
    printf("%s",name);
    getch();
}
Run Code Online (Sandbox Code Playgroud)

它似乎不起作用.这可能吗?我的意思是我们有什么方法可以创建一个字符串的switch语句.实际上如何解决问题?

c arrays string switch-statement

5
推荐指数
2
解决办法
3万
查看次数

如何从另一个类访问 textarea?

主类:

public class tuna {
    public static void main(String[] args) {   
        JFrame frame1 = new JFrame();           
        frame1.setVisible(true);
        frame1.add(new apple());
        frame1.setSize(200  , 240);    
    }
}
Run Code Online (Sandbox Code Playgroud)

二级

public class apple extends JPanel{
    JTextArea ta = new JTextArea();
    Border blackline = BorderFactory.createLineBorder(Color.black); 
     apple(){
         setBorder(blackline);
         System.out.println("apple");
         ta.setText("hello");
         ta.setEditable(false);
         add(ta);
         add(new doctor());
         repaint();
         revalidate();      
    }
}
Run Code Online (Sandbox Code Playgroud)

三级

    public class doctor extends JPanel implements ActionListener{
    public JButton butt = new JButton("change");
    Border blackline = BorderFactory.createLineBorder(Color.black); 
    public doctor(){
        setBorder(blackline);
        add(butt);
    }   
    @Override
    public void actionPerformed(ActionEvent e){     
        if(e.getSource() …
Run Code Online (Sandbox Code Playgroud)

java awt jpanel jbutton jtextarea

3
推荐指数
1
解决办法
4250
查看次数

x86汇编语法检查

我们将在下周对x86程序集进行一次考试,这段代码在语法检查中让我感到困惑.

字节ptr,word ptr等在x86汇编中意味着什么?

例如,NEG byte ptr [si]或者NEG word ptr [si]我知道这两个在x86汇编时是有效的语法,但为什么NEG byte ptr siNEG word ptr si无效?

syntax x86 assembly

2
推荐指数
1
解决办法
447
查看次数

标签 统计

arrays ×1

assembly ×1

awt ×1

c ×1

java ×1

jbutton ×1

jpanel ×1

jtextarea ×1

string ×1

switch-statement ×1

syntax ×1

x86 ×1