Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
CPP All : Structures Basics
Concept Learning Code Sheets

Structures demo program with int and char array #2767

A program using structure with two different type of variables int and char[] grouped in one structure.

Creating global instances or objects of structures #2777

A technique to create instances of a structure which can be used by many functions,

Initialising structure variables while creating instances #2795

A demonstration of initialisation of values of variables while creating the instances of the structures.

Effect of partial or no intialisation of structure instance variables #2799

Understanding default values in case of partial or no initialisation of structure instances.

Structure instance creation using pointer based notation #2911

A system of creating structure instances using pointer based notation or the method indicating the address location of the structure.

Structure instance copying #2916

Copying one instance of structure to another for the instances derived from the same structure definition

Case where structure instance copy is not allowed #2920

A program to explain the case where instance copying is not permitted.

Nesting of strucutres #2924

A program to demonstrate nested structures with one structure called within another structure.

Nested Structures Initialisation #2934

Program to demonstrate the initialisation process of nested structures.

Preparing Array of Structures #2938

Program to demonstrate how an array of structures is prepared to get entry of multiple similar type of data entries.


Solved Problems

Collect student details to structure and update selectively #2781

Write a program to collect follow entry about an student in a structure type

Write a program to collect follow entry about an student in a structure type c++ data structure.
integer – rollno, char array – name, float – marks and char passfail. Declare a global instance of this structure and then collect the rollno,name and marks in the main routine. Within the main routine update the value of passfail as ‘Y’ or ‘N’ if the marks are more than or equal to 33.0 . Finally it should report as per following example.

R.No. Name Marks Status
———————————
22       Vijay  45         Pass

Nested Structure Initialisation #2928

Write the output of the following program.

Write the output of the following program.

Finding errors in structure declaration #2961

Find the errors in the following structure declaration.

struct Computer 

Find the errors in the following structure declaration.

struct Computer {
 char type[40]="Laptop";
 char p;
 Computer comp;
 float price; 
};c1[20]

Output writing using strcpy for structure string variables #2964

Write the output of the following program. Assume that required header files

Write the output of the following program. Assume that required header files are present.

struct Game {
  char Magic[20];int Score;
};

int main()
{
  Game M={"Tiger",500};
  char a[20];
  cout<<M.Magic<<", "<<M.Score<<endl;
  strcpy(a,M.Magic);
  a[0]='L'; a[2]='o'; a[3]='n'; a[4]='';
  strcpy(M.Magic,a);
  M.Score++;
  cout<<M.Magic<<", "<<M.Score<<endl;
  return 0;
}

Code Sheets:10  Solved Problems:4 
×
Introductory Sessions Beginning to Program Tokens Keyword and Identifiers Data Types Variables and Constants Operators Simple User Input Building Expressions and Formulas Simple Real World Problems Simple If and If Else Multiple-Nested-Ladder of If Else Switch case selection Simple Loops Tricks in Loops - break continue scope Loop Applications - Handling numerals Series printing loops Nested Loops Pattern printing loops Number Varieties and Crunches String Handling (Null Terminated) Strings - string class type Functions (Built-in) Functions - user defined Functions Reference Passing/Returning Arrays Concepts and 1-D Arrays Array Data Management Two dimensional arrays and Matrices Structures Basics Structures passing/returning 2D Array Memory Addressing Display Using IO Manipulation Display Using C Formatting Tricks User Defined Data Types Enumerated Types Preprocessor Directives And Macros Exception Handling Programming Paradigms and OOPs Advantages Abstraction and Encapsulation Polymorphism Inheritance Function Overloading Concepts Function Overloading Varieties Function Overloading Special Cases Defining Classes Creating and Using Class Objects Class Members Accessibility Class Function Types Inline Functions Constant Functions Nesting of Functions Class Members Scope Resolution Static Members in a Class Array of Objects Constructor Concepts Default Constructor Parameterized Constructor Copy Constructor Constructor Overloading Destructors Inheritance Fundamentals Public Derivations Private and Protected Derivations Multiple Inheritance Mult-Level Inheritance Class Nesting Data File Concepts Handling Text Files Handling Binary Files Pointer Concepts Pointer and Arrays Pointers and Functions Object Pointers This Pointer Linked Lists Stacks Queues


Back