1、记忆部分:包括关键字,常用的系统函数,c的固定格式等
关键字,也就是main,int,for,while等,这些是c的保留字,在定义变量的时候不能用
系统函数,如printf,scanf,sin,strlen等
固定格式,如循环,分支,数组,读取文件,结构体等。还有一些经典的算法
2、算法部分,也就是解决问题的算法和c的实现语句。这个有可能牵扯到的数学修养很高,但是这个可以慢慢的学。遇到问题,找相应的数学模型
package testimport java.awt.BorderLayout
import java.awt.Dimension
import java.util.Random
import javax.swing.JFrame
import javax.swing.JLabel
import javax.swing.SwingUtilities
public class Content extends JFrame implements Runnable
{
private static final long serialVersionUID = 1L
public Thread thread
static JLabel label = new JLabel ()
String[] title = { "<学通Java的二十四堂课", "<学通c语言的二十四堂课", "<学通Java的二十四堂课", "<学通c语言的二十四堂课", "<学通Java的二十四堂课" }
public Content ( String title )
{
setTitle (title)
setSize (500, 500)
setLayout (new BorderLayout ())
setResizable (false)
setLocationRelativeTo (null)
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE)
}
private static void addComponent ( JFrame frame )
{
label.setPreferredSize (new Dimension (500, 500))
frame.add (label, BorderLayout.CENTER)
}
public void start ()
{
if (thread == null)
{
thread = new Thread (this)
thread.setPriority (Thread.MIN_PRIORITY)
thread.setName ("Content")
thread.start ()
}
}
public synchronized void stop ()
{
if (thread != null)
{
thread.interrupt ()
}
thread = null
notifyAll ()
}
@Override
public void run ()
{
Thread me = Thread.currentThread ()
while (thread == me && !isShowing () || getSize ().width == 0)
{
try
{
Thread.sleep (200)
}
catch (InterruptedException e)
{}
}
while (thread == me)
{
label.setText ("明日科技新书推荐" + title[new Random ().nextInt (title.length)])
try
{
Thread.sleep (1000)
}
catch (InterruptedException e)
{}
}
thread = null
}
public static void main ( String[] args )
{
SwingUtilities.invokeLater (new Runnable ()
{
@Override
public void run ()
{
Content content = new Content ("明日科技")
addComponent (content)
content.start ()
content.setVisible (true)
}
})
}
}