Answers for "how to create a struct in c++"

C++
3

struct c++

//Struct is a compound data type that contains different variables of different types.
struct Student
{
    char stuName[30];
    int stuRollNo;
    int stuAge;
};
Posted by: Guest on April-30-2021
6

structs in c++

#include <bits/stdc++.h>
#include <iostream>

#define ll long long

using namespace std;

struct student{
	int roll;
	string name;
	int age;
	
	void studentDetails(){
		cout<<"Name is "<<name<<" Age is "<<age<<" roll no is "<<roll<<endl;
	}
};


int main(){
	
	student sumant;
	sumant.roll = 30;
	sumant.name = "Sumant Tirkey";
	sumant.age = 18;
	
	sumant.studentDetails();
	cout<<endl;

    return 0;
}
Posted by: Guest on December-05-2020
1

how to create a struct in c++

struct product {
  int weight;
  double price;
} ;

product apple;
product banana, melon;
Posted by: Guest on August-20-2021
6

what is a struct in c++

struct Person
{
    char name[50];
    int age;
    float salary;
};
Posted by: Guest on August-06-2020
2

struct c++

struct Student
{
    string Nom;
    int Surn;
    int Age;
};
Posted by: Guest on September-17-2021
2

struct c++

struct product {
  int weight;
  double price;
} apple, banana, melon;
Posted by: Guest on November-29-2020

Browse Popular Code Answers by Language