Ⅰ java.編程者如何判斷用戶輸入的函數呢
通過分析用戶的輸入,得出用戶輸入的函數,這是一個語法解析的過程。
內置有一些關鍵字,+-*/ ^(乘方),sin cos tan ln e,等,自變數不妨統一要求為x,其餘需要你自己寫代碼來實現了。
Ⅱ 如何用命令行運行java程序及輸入main函數參數的輸入
main函數也可以帶參數。帶參數main函數的定義格式如下:
void main(int argc, char *argv[])
{
... ...
}
argc和argv是main函數的形式參數。這兩個形式參數的類型是系統規定的。如果main函數要帶參數,就是這兩個類型的參數;否則main函數就沒有參數。變數名稱argc和argv是常規的名稱,當然也可以換成其他名稱。
那麼,實際參數是如何傳遞給main函數的argc和argv的呢?我們知道,C程序在編譯和鏈接後,都生成一個exe文件,執行該exe文件時,可以直接執行;也可以在命令行下帶參數執行,命令行執行的形式為:
可執行文件名稱 參數1 參數2 ... ... 參數n
執行文件名稱和參數、參數之間均使用空格隔開。例如,在linux下運行程序./a.out 1 2 ,可執行文件名稱為./a.out,參數1為字元串1,參數2為2。
如果按照這種方法執行,命令行字元串將作為實際參數傳遞給main函數。具體為:
(1) 可執行文件名稱和所有參數的個數之和傳遞給argc;所以上面的argc=3
(2) 可執行文件名稱(包括路徑名稱)作為一個字元串,首地址被賦給argv[0],參數1也作為一個字元串,首地址被賦給argv[1],... ...依次類推。
Ⅲ java的輸入函數是什麼怎麼使用忘高手指點
用java.util.Scanner類,代碼如下
import java.util.*;
public class Scan {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int i = scanner.nextInt();
System.out.print(i);
}
}
Java 編程初步 傻瓜書
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159167
零基礎學Java電子教程 附隨書光碟
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=181032
數據結與演算法 Java語言版
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=160250
精通JBuilder 2005 中文版 高清PDF+隨書光碟
http://bbs.topsage.com/dispbbs_121_172861_1.html
程序天下:J2EE整合詳解與典型案例 電子教程+隨書光碟
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=181884
JSF JavaServer Faces in Action
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=160229
Spring in Action (第二版)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=146170
Manning jQuery in Action
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174769
Spring In Action
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174107
AspectJ in Action
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174106
Hibernate In Action
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174105
Struts in Action
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174005
Lucene in Action
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=173991
Wrox出版 Beginning Spring Framework 2
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=175714
Java Extreme Programming Cookbook
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174729
Java Programming Cookbook
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=173667
Beginning Java Objects
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174685
Building Java Enterprise App
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174684
Ant: The Definitive Guide
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174683
Better Faster Lighter Java
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174681
Hibernate Reference 3.1
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174674
Pragmatic Version Control using CVS
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174479
Pragmatic Project Automation
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174476
jQuery Reference Guide
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174411
Java 2 核心技術 卷1&卷2 CHM版
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174123
Wrox Professional Java JDK 6 Edition
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=163451
Java 2 寶典
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159154
侯捷java編程思想 PDF中文版
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=163902
Learning Java (第三版)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=146869
The Java Language Specification
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=176082
Beginning Java Programming for Dummies 第二版
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=163923
Java 2 核心編程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=146174
Java How to Program (第六版)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=146371
Java All-In-One案頭參考傻瓜書 (第二版)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=152871
21天自學 Java 6 (2007年5月更新出版) PDF
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159315
Java咖啡館
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151447
Thinking in Java(第四版)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=152053
深入學習JFC SWING - Java基礎類組件集
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=152049
J2EE全實例教程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=158057
Java信息系統設計與開發實例(第二版)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151993
Java優化編程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151994
Effective Java
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=175258
Java信息系統設計與開發實例(第二版)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151993
Tricks of the Java Programming
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159305
Wrox Professional Java Native Interfaces with SWT JFace
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159290
Java Swing 第二版 PDF文字版 O'Relliy出版
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159158
O'Reilly - Java Database Programming with JDBC
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159292
JDBC與Java資料庫程序設計
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151448
Learning JQurey (2007年7月最新出版)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159652
J2EE with BEA WebLogic Server
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=176088
Pragmatic Unit Testing in Java with JUnit
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=176084
Wiley出版 J2EE 1.4 Bible
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=176080
J2EE設計開發編程指南
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159288
Java Web Services簡明教程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159159
O'Reilly Java and XML (第二版PDF)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=146231
O'Reilly Java and XML (第三版PDF)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=167584
Java技術XML高級編程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=147800
Java Reflection in Action [MANNING]
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=178017
Java Puzzler (Java 解惑)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=178016
Java Database Best Practices
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=178015
Struts: The Complete Reference
http://bbs.topsage.com/dispbbs.asp?boardID=123&ID=178025
Log4j The Complete Manual
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=178023
Programming for the Java Virtual Machine
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=178021
Expert One-on-One J2EE Design and Development
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=160652
Expert One-on-One J2EE Development without EJB
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=160653
JBoss - A Developer's Notebook
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=146179
The Java Programming Language (第四版)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=147095
Professional Java Development with the Spring Framework
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159303
Core Java Server Faces 第二版
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=145549
精通Enterprise JavaBeans
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=146018
Enterprise JavaBeans EJB 第四版
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159166
J2EE應用與BEA WebLogic Server (第二版PDF)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=146227
O'Reilly Java Web Services
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=146377
Ant權威指南
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=148383
Ajax和Java框架高級編程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=148371
Java Web Services簡明教程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159159
Cross-Platform Web Services Using C# and Java
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=160472
O'Reilly Ajax on Java
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=160600
O'Reilly Java and XSLT
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=149585
O'Reilly Java and XML Binding
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=149583
O'Reilly Java and SOAP
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=149581
Design Patterns Java Companion
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=163920
J2EE Java黑客大曝光 開發安全的Java應用程序
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151446
J2ME API 速查手冊
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=158248
精通J2ME無線編程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=152047
J2ME開發大全
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151987
Beginning J2ME 從入門到精通 第三版
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=184149
Beginning JBoss Seam從入門到精通
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=183607
Beginning Hibernate 從入門到精通
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=183602
Java網頁開發的藝術
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151991
Java編程高手
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151990
Java 5.0 Tiger程序高手秘笈
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151989
Java2網路協議技術內幕(附源碼)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151988
Using Enterprise JavaBeans 2
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=166051
Java技術實用教程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=158244
企業級Java安全性(構建安全的J2EE應用)
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=152048
Java語言集成開發環境Eclipse中文教程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=158237
NetBeans IDE 5.5 企業版高級開發教程
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=159653
Using Enterprise JavaBeans 2
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=166051
Borland JBuilder Developer's Guide
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=166294
Eclipse [O'Reilly]
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=175257
Eclipse精要與高級開發技術
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=151986
Code Generation in Action
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=174722
Java 6 3D游戲開發
http://bbs.topsage.com/dispbbs.asp?boardID=121&ID=160251