Hi.. welcome to my site.. In here you want getting many IT
knowledge likely this article describes the dekstop programming, that is language
programming “C++”.
Previous I was giving youmany tutorial about it, and now I want
disscus about structures of C++. Ok let’s do read my article…
Data structures in c + + is a collection of various data
types differ from one size to another data type and are grouped in a single
declaration are unique.
Syntax :
struct blog_wak
logic :
blog_wak which is the name for the model structure
object_of_name is a valid identifier for the object its structureExample 1 :
struct animals
{
char name [30];
float price;
} ;
animals cook;
animals fly, dog;
Example 2:
You can copy this coding in your compiler likely borland or turbo
#include <iostream.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
struct animals
{
char name [100];
int age;
}
fury, born;
void printmovie (animals movie);
int main ()
{
char buffer [50];
strcpy (fury.name, "10 quadrupeds the nine tailed weasel");
fury.age = 1968;
cout << "Enter name: ";
cin.getline (born.name,50);
cout << "Enter age: ";
cin.getline (buffer,50);
born.age = atoi (buffer);
cout << "My favourite movie is:\n ";
printmovie (fury);
cout << "And yours:\n ";
printmovie (born);
getch();
}
void printmovie (animals movie)
{
cout << movie.name;
cout << " (" << movie.age << ")\n";
}
To result :
Enter name :
Enter age :
Note : :
You must change all quotes(" ") or (' ') if you using copy and paste
you must input the name and age.., if your input for
name is we are knowledge and for age is 10, result become :
Enter name: we are knowledge
Enter age: 10
My favourite movie is:
10 guadrupeds the nine tailed weasel (1968)
And your:
We are knowledge (10)
Ok.. just it…
I hope like with my article..
Don’t forget to backe to my site..
See you later…
No comments:
Post a Comment