Решение такое (для x=1,2,3,4,5,6,7,8,9,10. ):
var
x, y: real;
begin
writeln('*********************');
writeln('* X * Y *');
writeln('*********************');
for x := 1 to 10 do
begin
if x>=0 then y:=5*x else y:=4*x+2;
writeln('* 'x,' * ',y,' *');
end;
writeln('*********************');
end.
Но лучше сделать ввод значений х с клавиатуры:
var
y: real; i:integer;
mas: array[1..10] of real;
begin
for i := 1 to 10 do
begin
write ('Введите ',i,'-е значение ');
readln (mas[i]);
end;
writeln('*********************');
writeln('* X * Y *');
writeln('*********************');
for i := 1 to 10 do
begin
if mas[i]>=0 then y:=5*mas[i] else y:=4*mas[i]+2;
writeln('* ',mas[i],' * ',y,' *');
end;
writeln('*********************');
end.
- DrinkActivity.java
TextView t ;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drink);
t = (TextView)findViewById(R.id.TextView01);
t.setOnClickListener((android.view.View.OnClickListener) this);
}
public void onClick(View arg0) {
t.setText("My text on click");
}
- activity_drink.xml
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</LinearLayout>
<ListView
android:id="@+id/ListView01"
android:layout_width="wrap_content"
android:layout_height="match_parent" >
</ListView>
<LinearLayout
android:id="@+id/LinearLayout02"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</LinearLayout>
<TextView android:text="This is my first text"
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:textStyle="bold"
android:textSize="28sp"
android:editable="true"
android:clickable="true"
android:layout_height="wrap_content"
android:onClick="onClick">
</TextView>
Объяснение: