/  9
 
Practices AssignmentC++ : Structures
Submitted By : Nita aroraKHMS
 
Practices AssignmentC++ : Structures
S.NO.SubPartQuestionMarks
Q1.(a)
Find the errors if any: -void main(){struct data{int roll =0;struct data1{float phy;}x;x.phy=90;}y;cout<<y.roll<< “<<y.phy;}
(b)
(a)
Rewrite the following program after removing all syntacticalerror(s), if any. Underline each correction.#include<iostream.h>int main(){structure student{int. rno, mark;}stu;student stuA= (1001,49);student stuB= stuA;if (stuA!= stuB)stuA.mark= 55;elsestuB.mark= 25;cout<<stuA.mark<<stub.mark;}(2)
(c)What will be the output of the following code:-
struct Item{int I_no;char I_name[20];float I_price;int I_qty;};void main(){
Submitted By : Nita aroraKHMS
 
Practices AssignmentC++ : Structures
Item S[4]= {{1,”Bread”,11.0,20},{2, “Butter”,25.0,40},{3,”Cream”,65,15},{4,”Jam”,95.5,20}};cout<<S[0].I_no;cout<<S[1].I_name[4];cout<<S[2].I_qty;cout<<S[3].I_name;}
(d)
Find the output of the following program:
3#include <iostream.h>struct GAME{ int Score;int Bonus;};void Play(GAME &g, int N=10){g.Score++;g.Bonus+=N;}void main(){GAME G={110,50};Play(G,10);cout<<G.Score<<":"<<G.Bonus<<endl;Play(G);cout<<G.Score<<":"<<G.Bonus<<endl;Play(G,15);cout<<G.Score<<":"<<G.Bonus<<endl;}
(e)
Rewrite the following program after removing all syntactical error(s), if any. Underline each correction.#include<iostream.h>int main(){structure student{int. rno, mark;}stu;student stuA= (1001,49);student stuB= stuA;if (stuA!= stuB)stuA.mark= 55;elsestuB.mark= 25;cout<<stuA.mark<<stub.mark;(2)
Submitted By : Nita aroraKHMS

Share & Embed

More from this user

Add a Comment

Characters: ...