Struct Değişkeni Oluşturma
# Struct Kullanımı
Struct yalnızca veri tipini tanımlar.
Bu yapıdan veri oluşturabilmek için bir struct değişkeni (nesnesi) oluşturulmalıdır.
Oluşturulan her değişken kendi bilgilerini saklar.
Örnek Kod
#include <iostream>
#include <string>
using namespace std;
struct Ogrenci
{
string ad;
int yas;
};
int main()
{
Ogrenci ogr1;
ogr1.ad = "Ahmet";
ogr1.yas = 20;
cout << ogr1.ad << endl;
cout << ogr1.yas;
return 0;
}🎯 Bu Dersteki Görevler
Öğrenci Oluştur
Dil: cpp
Yükleniyor…