Kamis, 25 April 2013

TEKNIK KOMPILASI

TUGAS ANALISA LEKSIKAL UNTUK PROGRAM C++

source code



output
#include <iostream.h>
#include <conio.h>
void main ()
{
clrscr ();
char nama [20], npm [9], kelas [5];
int nilai, uts, uas;
cout << "NAMA : "; cin >> nama;
cout << "NPM : "; cin >> npm;
cout << "KELAS : "; cin >> kelas;
cout << "UTS : "; cin >> uts;
cout << "UAS : "; cin >> uas;
nilai = (uts+uas)/2;
cout << "\n";
cout << "Nama Anda "<<nama<<", NPM Anda "<<npm<<", Kelas Anda "<<kelas<<", Nilai Anda "<<nilai; if (nilai>=70)
cout << " anda lulus";
else
cout << " anda gagal";
getch ();
}



KETERANGAN
Identifier
Keyword
Literals
Operator
Punctuation
Iostream
include
20
+
< 
conio.h
void main
9
=
> 
main
char
5
/
(
Clrscr
\n
2

)
nama
else
70

;
npm
If


:
kelas
Int


cout



[
cin



]
uts



{
uas



}
nilai




Anda lulus




Anda gagal




getch




Tidak ada komentar:

Posting Komentar