小编5an*_*oro的帖子

我的简单C程序没有编译

我正在为我的C级做一个小练习,我遇到的困难我知道不应该真的发生,因为这些应该花费最多30分钟.到目前为止,这是我的程序:

#include <stdio.h>
#include <stdbool.h>
#define LIMIT 1000000;

bool isPrime( int num ) {
    for ( int factor = 2; factor * factor <= num; factor++ )
      if ( num % factor == 0 )
        return false;

    return true;
  }

int main() {
  for ( int num = 2; num <= LIMIT; num++ ) {
    if ( isPrime( num ) ) {
      printf( num );
    }
  }
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

primes.c: In function “main”:
primes.c:14: error: expected expression before …
Run Code Online (Sandbox Code Playgroud)

c

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

运行GUI时没有任何反应

我正在为我的班级做一个项目,我现在正在开发GUI.我没有太多,因为它没有出现,而且令人气愤.这是我的代码.

public class BookQuizGUI extends JFrame implements ActionListener
{
    private Container c;
    private JPanel pnlButtons;
    private JButton addQs;
    private JButton takeQuiz;
    private JButton quit;

    private Container c2;
    private JPanel pnlButtons2;
    private JComboBox qType;
    private JComboBox ans;
    private JTextField q;
    private JTextField cA;
    private JTextField cB;
    private JTextField cC;
    private JTextField cD;
    private JButton add;
    private JButton writeAll;
    private JButton done;

    /**
     * 
     */
    public BookQuizGUI()
    {
        //The main screen for when the program starts
        c = getContentPane();
        pnlButtons = new …
Run Code Online (Sandbox Code Playgroud)

java user-interface swing jframe

-1
推荐指数
1
解决办法
88
查看次数

标签 统计

c ×1

java ×1

jframe ×1

swing ×1

user-interface ×1