THE DIFFERENCE OF DATA TYPES
DATA OBJECTS AND DATA STRUCTURES
The data type is the type of data that can be handled by a computer programming language, each programming language has a data type.
The data object is a collection of elements that may be for a specific data type
example :
integer refers to data objects -32 768 s / d 32767, byte 0 s / d 255, the string is a collection of characters max 255 letters
The data structure is a way of storing and organizing data in a computer's memory and file effectively so that it can be used efficiently, including operations in it.
The C language has a numeric and character data types (such as int, float, char, etc.). Besides, it also has an enumerated data type and structure. What if we want to create a new data type?
For the manufacture of new types of data used keyword typedef,
The general form:typedef <old data type> <new data type>
for example :
#include <iostream.h>
#include <conio.h>
//#include <stdio.h>
typedef int angka;
typedef float pecahan;
typedef char huruf;
main(){
clrscr();
angka umur;
pecahan pecah;
huruf h;
huruf nama[10];
cout<<"masukkan umur anda : ";cin>>umur;
cout<<"Umur anda adalah "<<umur;
cout<<"\nmasukkan bilangan pecahan : ";cin>>pecah;
cout<<"Bilangan pecahan "<<pecah;
cout<<"\nmasukkan huruf : ";cin>>h;//h=getche();
cout<<"Huruf anda "<<h;
cout<<"\nmasukkan nama : ";cin>>nama;
cout<<"Nama anda "<<nama;
getch();}
result of the code :
Ok gaes....I think is enough about The difference of Data Types, Data Objects and Data Structures.
0 comments:
Posting Komentar