Category : structure

#include <stdio.h> #define N 100 #include "struct.h" #include "stdata.h" struct test_data(student st)=(student *p,char *id, char *name, int eng, int math, int phys) { strcpy(p->id,id); strcpy(p->name,name); p->eng = eng; p->math = math; p->phys = phys; } int main() { ; int i; int total; float avg; float var; total = 0; avg = 0.0; var = ..

Read more

Im currently going through C++ Basics in data structure and have a small doubt regarding strings I am trying to input a string value from the main function by creating an instance of a structure object in the main function. #include<iostream> #include<sstream> #include<string> using namespace std; struct StudentData { string name[50]; char rollNo[20]; int semester; ..

Read more

#include<iostream> #include<conio.h> #include<stdio.h> #include<stdlib.h> using namespace std; struct array{ int *A; int size; int length; }; void Display(struct array arr){ int i; cout<<"nElements of Array are:"; for(i=0;i<arr.length;i++){ printf("%d",arr.A[i]); } } int main(){ struct array arr; int n,i; cout<<"Enter the size of Array n"; cin>>arr.size; arr.A=new int[arr.size]; arr.length=0; cout<<"Enter no of Elements"; cin>>n; cout<<"Enter All Elements"; ..

Read more