Fatihul Ulum Community of Knowledge
Would you like to react to this message? Create an account in a few clicks or log in to continue.

the while loop!

2 posters

Go down

the while loop! Empty int main

Post  zz Fri Mar 20, 2009 3:20 am

mas candra, sampean pernah mencoba yang begini
#include <iostream>
using namespace std;
void main ()
{
cout<<"ini akan error"<<endl;
}
//coba kompile
//dalam c++ main harus bertype int tidak boleh yang lain
zz
zz
Panglima
Panglima

Jumlah posting : 121
Age : 78
Lokasi : france
Registration date : 13.02.09

Kembali Ke Atas Go down

the while loop! Empty the while loop!

Post  candra Sat Mar 14, 2009 11:30 am

include //kalau dalam dalam cpp jangan lupa memasang library
using namespace std;
int main() //type ini tidak harus memakai int
{
int n; //memperkenalkan variabel n
cout << "Enter the starting number = ";
cin >> n;

while (n>0) {
cout << n << ", ";
--n;//
}

cout << "maka nilai n = ";
return 0;
candra
candra
Pemula
Pemula

Jumlah posting : 16
Age : 33
Lokasi : jember
Registration date : 10.03.09

http://www.hariantoachmad.wordpress.com

Kembali Ke Atas Go down

Kembali Ke Atas

- Similar topics

 
Permissions in this forum:
Anda tidak dapat menjawab topik