C++ Program

Tuesday, July 31, 2012


Write A C++ Program To Read Values Into A Nested Stucture. 


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
struct addr
{
int houseno;
char area[30];
char city[30];
char state[30];
};
struct emp
{
int empno;
char name[26];
char desig[26];
addr address;
float basic;
}worker;
int main()
{
clrscr();
cout<<"\n enter employee no.:\n";
cin>>worker.empno;
cout<<"\n name:\n";
gets(worker.name);
cout<<"\n enter designation:\n";
gets(worker.desig);
cout<<"\n enter address:\n";
cout<<"\n house no.:\n";
cin>>worker.address.houseno;
cout<<"\n area:\n";
gets(worker.address.area);
cout<<"\n city:\n";
gets(worker.address.city);
cout<<"\n basic pay:\n";
cin>>worker.basic;


cout<<"\n ***********\n";
cout<<"\n employee no.:\n ";
cout<<worker.empno;
cout<<"\n name:\n ";
puts(worker.name);
cout<<"\n designation:\n ";
puts(worker.desig);
cout<<"\n :address:\n ";
cout<<"\n house no.:\n ";
cout<<worker.address.houseno;
cout<<"\n area:\n ";
puts(worker.address.area);
cout<<"\n city:\n ";
puts(worker.address.city);
cout<<"\n basic pay:\n ";
cout<<worker.basic;
getch();
return 0;
}

ELECTROSTATICS





ELECTROSTATICS - Frequently asked questions
  1. Define the term electric dipole moment. Is it scalar or vector quantity?
  2. An electric dipole of dipole moment 20 x 10-6 Cm is enclosed by a closed surface. What is the net flux coming out of the surface?
  3. Define the term electric flux. Write its SI unit.
  4. An electric dipole of length 10 cm having charges ± 6 x 10-3 C, placed at 300 with respect to a uniform electric field, experiences a torque of 6√3 Nm. Calculate: (1) The magnitude of the electric field.(2) The potential energy of the dipole.
  5. A charge q is placed at the centre of the line joining the two equal charges Q Show that the system of three charges will be in equilibrium if q = - Q/4.
  6. Two fixed point charges + 4e and + e units are separated by a distance ‘a’. Where should the third point charge be placed for it to be in equilibrium?
  7. Two similarly and equally charged identical metal spheres A and B repel each other with a force of 2 x 10-5 N. A third uncharged sphere C is touched with A and then placed at the mid point between A and B. Calculate the net electric force on C.
  8. State Gauss’s theorem in electrostatics. A charge of 17.7 x 10-4 C is distributed uniformly over a large sheet of area 200 sqm . Calculate the electric field intensity at a distance 20 cm from it in air.
  9. An electric dipole is free to move in a uniform electric field . Explain its motion when it is placed (1) parallel to the field and (2) perpendicular to the field.
  10. Two identical metallic spheres ,having unequal, opposite charges are placed at a distance 0.90 m apart in air. After bringing them in contact with each other , they are again placed at the same distance apart. Now the force of repulsion between them is 0.025 N. Calculate the final charge on each of them.
  11. Force of attraction between two point charges placed at a distance ‘d’ apart in a medium is F. What should be the distance in the same medium so that the force of attraction between them becomes 9F?
  12. Two point charges of + 3 x 10-19 C and + 12 x 10-19 C are separated by a distance of 2.5 m. Find the point on the line joining them at which the electric field intensity is zero.
  13. A hollow conducting sphere of radius 8 cm is given a charge 16 µC . What is the electric field intensity?(1) at the centre of the sphere and (2) on the outer surface of the sphere.
  14. Two point electric charges of values q and 2q are kept at a distance ‘d’ apart from each other in air. A third charge Q is to be kept along the same line in such a way that the net force acting on q and 2q is zero. Calculate the position of charge Q in terms of q and d.
  15. What is electric flux? Write its SI unit.Using Gauss’s theorem , deduce an expression for the electric field at a point due to uniformly charged infinite plane sheet.
  16. What is an electric dipole ? Derive an expression for the torque acting on an electric dipole, when held in a uniform electric field. Hence define the dipole moment.
  17. Find the value of electric field that would exactly balance the weight of electron.
  18. There is a sphere of radius 20 cm.What charge should be given to the sphere so that it acquires a surface charge density of 3/π C/sqm?
*********************************************************************************

Answers coming soon!!!

Blogroll

Bookmark and Share
Powered By Blogger
CBSE 12th Grader.