This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Exercise 4-12. Adapt the ideas of printd to write a recursive version of | |
* itoa; that is, convert an integer into a string by calling a recursive | |
* routine. | |
*/ | |
#include <math.h> | |
#include <string.h> | |
void itoa(int n, char s[]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RowAdapter extends CursorAdapter { | |
private final LayoutInflater mInflater; | |
public RowAdapter(Context context, Cursor c, boolean autoRequery) { | |
super(context, c, autoRequery); | |
mInflater = LayoutInflater.from(context); | |
} | |
public RowAdapter(Context context, Cursor c) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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="wrap_content" | |
android:orientation="horizontal"> | |
<ImageView | |
android:src="@drawable/nba" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_weight="1"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Exercise 5-3. Write a pointer version of the function strcat that we | |
* showed in Chapter 2:strcat(s, t) copies the string t to the end of s. | |
*/ | |
#include <stdio.h> | |
void my_strcat(char *s, char *t) | |
{ | |
while (*s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Exercise 5-2. Write getfloat, the floating-point analog of getint. What | |
* type does getfloat return as its function value? | |
*/ | |
#include <stdio.h> | |
#include <ctype.h> | |
int getch(void); | |
void ungetch(int); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Exercise 5-1. As written, getint treats a + or - not followed by a | |
* digit as a valid representation of zero. Fix it to push such a character | |
* back on the input. | |
*/ | |
#include <stdio.h> | |
#include <ctype.h> | |
int getch(void); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Exercise 5-4. Write the function strend(s,t), which returns 1 if the | |
* string t occurs at the end of the string s, and zero otherwise. | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int strend(char *s, char *t) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Quicksort sorts by employing a divide and conquer strategy to divide a | |
* list into two sub-lists.Full example of quicksort on a random set of | |
* numbers. The boxed element is the pivot. It is always chosen as the | |
* last element of the partition. | |
* | |
* The steps are: | |
* 1. Pick an element, called a pivot, from the list. | |
* 2. Reorder the list so that all elements which are less than the pivot | |
* come before the pivot and so that all elements greater than the pivot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" android:layout_width="fill_parent" | |
android:layout_height="fill_parent"> | |
<WebView | |
android:id="@+id/webview_1" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
android:layout_weight="1.0"/> | |
<WebView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package cn.yo2.aquarium.webviewtest; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.webkit.WebView; | |
public class Main extends Activity { | |
/** Called when the activity is first created. */ | |
@Override | |
public void onCreate(Bundle savedInstanceState) { |