9 Mart 2010 Salı

C++ ile Struct(Yapi) Kullanımı

//www.ethemsulan.com
#include <cstdlib>
#include <iostream>
#include<cstring>
using namespace std;
struct yapi{
       yapi(double b,char *n);
       void show();
       private:
               double balance;
               char name[40];
       };
yapi::yapi(double b,char *n){
                  balance=b;
                  strcpy(name,n);
                  }
void yapi::show(){
     cout<<"isim: "<<name<<endl;
     cout<<"$ : "<<balance<<endl;
     }
int main(int argc, char *argv[])
{
    yapi aci(100.102,"Ethem");
    yapi aci2(123.23,"Mehmet
    aci.show();
    aci2.show();
    system("PAUSE");
    return EXIT_SUCCESS;
}

Hiç yorum yok:

Yorum Gönder