Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Write a function that uses s Student reference variable as its paramet.docx

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité

Consultez-les par la suite

1 sur 2 Publicité

Write a function that uses s Student reference variable as its paramet.docx

Télécharger pour lire hors ligne

Write a function that uses s Student reference variable as its parameter and stores the user\'s input in the structure\'s members. In C++
Solution
struct student getData(struct student stu){
cout<<\"Enter Name: \";
cin>>stu.name;
cout<<\"Enter roll: \";
cin>>stu.roll;
return stu;
}
Pasted the whole prog as well
#include <iostream>
using namespace std;
#include <stdio.h>
struct student{
char name[50];
int roll;
};
struct student getData(struct student stu){
cout<<\"Enter Name: \";
cin>>stu.name;
cout<<\"Enter roll: \";
cin>>stu.roll;
return stu;
}
void display(struct student stu){
cout<<\"Name: \"<<stu.name<<endl;
cout<<\"Roll: \"<<stu.roll<<endl;
}
int main(){
struct student s1;
s1=getData(s1);
display(s1);
return 0;
}
.

Write a function that uses s Student reference variable as its parameter and stores the user\'s input in the structure\'s members. In C++
Solution
struct student getData(struct student stu){
cout<<\"Enter Name: \";
cin>>stu.name;
cout<<\"Enter roll: \";
cin>>stu.roll;
return stu;
}
Pasted the whole prog as well
#include <iostream>
using namespace std;
#include <stdio.h>
struct student{
char name[50];
int roll;
};
struct student getData(struct student stu){
cout<<\"Enter Name: \";
cin>>stu.name;
cout<<\"Enter roll: \";
cin>>stu.roll;
return stu;
}
void display(struct student stu){
cout<<\"Name: \"<<stu.name<<endl;
cout<<\"Roll: \"<<stu.roll<<endl;
}
int main(){
struct student s1;
s1=getData(s1);
display(s1);
return 0;
}
.

Publicité
Publicité

Plus De Contenu Connexe

Plus par lez31palka (20)

Publicité

Write a function that uses s Student reference variable as its paramet.docx

  1. 1. Write a function that uses s Student reference variable as its parameter and stores the user's input in the structure's members. In C++ Solution struct student getData(struct student stu){ cout<<"Enter Name: "; cin>>stu.name; cout<<"Enter roll: "; cin>>stu.roll; return stu; } Pasted the whole prog as well #include <iostream> using namespace std; #include <stdio.h> struct student{ char name[50]; int roll; }; struct student getData(struct student stu){ cout<<"Enter Name: "; cin>>stu.name; cout<<"Enter roll: "; cin>>stu.roll; return stu; } void display(struct student stu){ cout<<"Name: "<<stu.name<<endl;
  2. 2. cout<<"Roll: "<<stu.roll<<endl; } int main(){ struct student s1; s1=getData(s1); display(s1); return 0; }

×