Do not Click
Animation
This program almost same with others animation program. The $ character will be printed on the top of the screen.
This program created using C++ editor. Here is the code:
#include
#include
#include
void main()
{
int x,y,ay;
clrscr();
x=random(78)+1;
y=random(4)+1;
ay=random(5)+1;
_setcursortype(_NOCURSOR);
textcolor(random(16));
do{
gotoxy(x,y); cprintf("$");
delay(100);
gotoxy(x,y); cout<<" "; y=y+ay; x=random(78)+1; if (y>=20)
{
gotoxy(x,y); cprintf("$");
x=random(78)+1;
y=random(4)+1;
ay=random(5)+1;
textcolor(random(16));
}
}while(!kbhit());
getch();
}
Goodbye my friend
Dear friend, this might be the last word from me, I apologize for all my mistakes. Each meeting there must be separation, Pray for me, so I was always given the strength and always in His protection. I want to invite you, but I'm sure you will not get. Carving my name in your heart as someone special. GOODBYE MY TRUE FRIENDS, I ALWAYS REMEMBER YOU. I'll go to Japan to help Ultraman, Cosmos and Black Steel Kastria to fight monsters Gorong-gorong and Ulat Bulu. Do not laugh this noble task, you know! .. Miss you-signed Bertopeng Heroes.
Adding and showing data in dynamic arrays
The following discussion is a continuation of the previous postings. To add data, we need to add the following program code:
ReDim Preserve strname(l - 1)
Write("Enter your name: ")
strname(l - 1) = ReadLine()
the results can be seen on the display below:
If we want to see data, it is necessary to add the following program code:
For Each name In strname
Write("Name: " & name)
Next
the results can be seen on the display below:
For advanced stage can be added to the source code of how to edit the wrong data and delete data that is not used anymore.
Simple data entry with an array
This program will demonstrate to us how to process the data by using an array. There are two things that will be made on this program, namely to add data into the array and display the data and the program we made this time using the console application. The following program display:
based on the view above, all we have to do in this program is starting from the bottom. By default, usually at the time of printing characters always starts from the top, but this time we run from the bottom. how to make the source code? Just a simple code shows below:
For i = 1 To 25
WriteLine()
Next
Further discussion will be presented in the next posting.
Trim and strlen function
After studying the variables, we continued the discussion of the trim and strlen function. The second function is used to manipulate the string.
- Trim (); used to remove the spaces on the right or left a text, examples of program code is as follows:
< ? php
$text=" test trim ";
$text=trim($text);
echo $text.$text;
?>
Output:
test trimtest trim
- Strlen(); used to calculate the text length, examples of program code is as follows:
< ? php
$text1=" test trim ";
$text2=trim($text1);
$lentext1=" Text1 Length = ".strlen($text1);
$lentext1=" Text2 Length = ".strlen($text2);
echo $lentext2."
";
echo $lentext1;
?>
Output:
Text1 Length = 11
Text2 Length = 9