Rabu, 22 Desember 2010

array 2 dimensi dengan nama

#include <iostream.h>
#include <stdlib>

using namespace std;

int main(int argc, char *argv[])
{
int contoh[2] [2];
char name[4] [4];

for (int i = 0; i < 2; i++) 

 { for (int j = 0; j < 2; j++) {

cout << " masukan contoh " << i << " " << j << " "; 
cout << " : " ; cin >> contoh[i][j];

}
}
for (int i = 0; i < 2; i++) 

{ for (int j = 0; j < 2; j++) { 

cout << " " << contoh[i][j] << " ";


cout << endl; 


for (int i = 0; i < 4; i++ ){ 

cout << " masukan nama "; cin >> name[i];
}
for (int i = 0; i < 4; i++) {
cout << name[i] << endl;
}


system("PAUSE");
return EXIT_SUCCESS;
}

array 2 dimensi

#include
#include
#include

using namespace std;

int main(int argc, char *argv[])
{
int contoh[2] [2];
char name[4] [4];

for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { cout << " masukan contoh " << i << " " << j << " "; cout << " : " ; cin >> contoh[i][j];

}
}
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
cout << " " << contoh[i][j] << " ";
}
cout << endl;
}

system("PAUSE");
return EXIT_SUCCESS;
}

array

#include
#include
#include

using namespace std;

int main(int argc, char *argv[])
{
char kata[10]="saya ";
char *kata1="suka ";
string kata2="dasar-dasar pemrograman";


cout<
char s[100]= "saya cinta";
char s1[100]= " universitas ahmad dahlan " ;

cout << " sebelum strcat (s, s1)" << endl;
cout << "\t s : " << s << endl;
cout << "\t s1 : " << s1 << endl;

strcat(s, s1);

cout << " sebelum strcat (s, s1)" << endl;
cout << "\t s : " << s << endl;
cout << "\t s1 : " << s1 << endl;
cout << s << endl;







system("PAUSE");
return EXIT_SUCCESS;
}

ALL INFORMATION Copyright © 2011 | Template created by O Pregador | Powered by Blogger