我是C的新手(我对C#[Visual Studio]和Java [Eclipse]有很好的了解)我想创建一个存储信息的程序.我的第一直觉是使用像SQL Server这样的数据库.但我不认为它与C兼容.所以现在我有两个选择:
您认为哪种选择最好?或者你还有其他选择吗?我倾向于使用typedef创建一个结构,但可以追求改变我的想法.
main.c(所有标题如stdio,stdlib等):
int main()
{
int input;
while(1)
{
printf("\n");
printf("\n1. Add new node");
printf("\n2. Delete existing node");
printf("\n3. Print all data");
printf("\n4. Exit");
printf("Enter your option -> ");
scanf("%d", &input);
string key = "";
string tempKey = "";
string tempValue = "";
Node newNode;
Node temp;
switch (input) {
case 1:
printf("\nEnter a key: ");
scanf("%s", tempKey);
printf("\nEnter a value: ");
scanf("%s", tempValue); //execution ternimates here
newNode.key = tempKey;
newNode.value = tempValue;
AddNode(newNode);
break;
case 2:
printf("\nEnter the key of …Run Code Online (Sandbox Code Playgroud) 在iPhone/iPod touch上,设置可以保存在Settings.app中.你能在Android上做到这一点吗?或者您的设置必须在实际应用程序中?
我想制作一个比较披萨价格的应用程序.要做到这一点,我必须去实际的网站,然后输入并搜索.如何在没有用户看到访问网站和输入搜索的操作的情况下显示价格.我会使用WebView和WebViewClient吗?
如何在Java中实现数学公式?
我的意思是,用户输入一个包含多个变量的字符串.就像一个简单的二次公式:x ^ 2 + 5x + 10.或者在Java中:(Math.pow(x,2)) + (x * 5) + 10.然后用户输入,然后程序将解决x.我将使用BeanShell Interpreter类将字符串解释为方程式.但是我如何解决x?
如何将参数从C main函数传递给汇编函数?我知道我的自定义函数必须看起来像:
void function(char *somedata) __attribute__((cdecl));
Run Code Online (Sandbox Code Playgroud)
现在我将如何somedata在程序集文件中使用.我的操作系统是Linux Ubuntu,我的处理器是x86.
这是LogCat所说的:
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): java.lang.NoSuchMethodError: com.mohit.geo2do.activities.TasksList.showDialog
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.mohit.geo2do.activities.TasksList.onContextItemSelected(TasksList.java:190)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.app.Activity.onMenuItemSelected(Activity.java:2183)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.policy.impl.PhoneWindow$ContextMenuCallback.onMenuItemSelected(PhoneWindow.java:2785)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:140)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.view.menu.MenuDialogHelper.onClick(MenuDialogHelper.java:129)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:898)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.widget.AdapterView.performItemClick(AdapterView.java:301)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.widget.ListView.performItemClick(ListView.java:3626)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.widget.AbsListView$PerformClick.run(AbsListView.java:3600)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.os.Handler.handleCallback(Handler.java:587)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.os.Handler.dispatchMessage(Handler.java:92)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.os.Looper.loop(Looper.java:123)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at android.app.ActivityThread.main(ActivityThread.java:4363)
01-21 17:20:06.057: ERROR/AndroidRuntime(27463): at …Run Code Online (Sandbox Code Playgroud) 例如,我想检索内部和外部存储上的所有.mp3文件的列表.我还想要String每个.mp3文件的path()作为参考(将它们存储在一个List?)我怎么能这样做?这是一个相对昂贵的操作吗?如果是这样,它应该放在一个线程上并且在运行时,向用户显示"正在加载" ProgressDialog?
这是我的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<ListView android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@android:id/list" />
<EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/search" android:hint="Filter results" />
Run Code Online (Sandbox Code Playgroud)
是什么导致我ListView掩盖我的编辑文本?
我有一个字符串:
C6H14
Run Code Online (Sandbox Code Playgroud)
我想要的是:
C<sub>6</sub>H<sub>14</sub>
Run Code Online (Sandbox Code Playgroud)
所以基本上我想<sub>在数字之前和数字</sub>之后添加.我怎么能做到这一点?请记住,String可以无限长:
X4Y6Z10W4T12
Run Code Online (Sandbox Code Playgroud)