Vous êtes sur la page 1sur 5

string nxaddressing amMO OK?

,
int phone; en​nn​ter your first and last name:"<<endl;
cin>>peel1.name;
comq😵nut<<"pleazvse enter your age:"<<endl;
cin>>peel1.age;

Kh cout<<"please Oenter your address:"<<endl;


cin>>peconquerel1.address;
cout<<"please enter your phone number:"; cin>>peel2.phone;

cout<<"your name"<<" "<<"your age"<<" your address"<<" your


phone"<<endl;
cout<<peel1.name<<" "<<peel1.age<<" ";
cout<<peel1.address<<" "<<peel2.phone<<endl;

system("PAUSE");
return EXIT_SUCCESS;
}

)))))))))))))))))))))))))))))))))))))))))))

/*********************************************************************/
/*Collin Dailey */
/*B3 */
/*3/23/17 */
/*Structure Student */
/*Asks for 3 students first names, last names, ID, and students grade*/
/*********************************************************************/
#include <cstdlib>
#include <iostream>

using namespace std;


struct cow
{ string firstname;
string lastname;
int grade;
int ID;
};
void getstudent ( cow[]);
void printstudent (cow[]);//declare void functions
int main(int argc, char *argv[])
{
cow student1;
cow student2;
cow student3;

cow Mystudents[2];

cout<<"please enter students first name:"<<endl;


cin>>student1.firstname;
cout<<"please enter students last name;"<<endl;
cin>>student1.lastname;

cout<<"please enter the students ID:"<<endl;


cin>>student1.ID;
cout<<"Please enter the students grade:"<<endl;
cin>>student1.grade;

cout<<"please enter students first name:"<<endl;


cin>>student2.firstname;
cout<<"please enter students last name;"<<endl;
cin>>student2.lastname;

cout<<"please enter the students ID:"<<endl;


cin>>student2.ID;
cout<<"Please enter the students grade:"<<endl;
cin>>student2.grade;

cout<<"please enter students first name:"<<endl;


cin>>student3.firstname;
cout<<"please enter students last name;"<<endl;
cin>>student3.lastname;

cout<<"please enter the students ID:"<<endl;


cin>>student3.ID;
cout<<"Please enter the students grade:"<<endl;//get all the info
cin>>student3.grade;

system("cls");
cout<<"students first name"<<" "<<"students last name"<<" "<<"students ID"<<"
"<<"students grade"<<endl;
cout<<student1.firstname<<" "<<student1.lastname<<"
"<<student1.ID<<" "<<student1.grade<<endl;
cout<<student2.firstname<<" "<<student2.lastname<<"
"<<student2.ID<<" "<<student1.grade<<endl;
cout<<student3.firstname<<" "<<student3.lastname<<"
"<<student3.ID<<" "<<student1.grade<<endl;//display all that

getstudent(Mystudents);

printstudent(Mystudents);

system("PAUSE");
return EXIT_SUCCESS;
}

void getstudent ( cow d[])


{
int i;
for(i=0; i<4; i++)
{

cout<<"please enter the students first name:"<<endl;


cin>>d[i].firstname;
cout<<"please enter the students last lame:"<<endl;
cin>>d[i].lastname;
cout<<"please enter the students ID:"<<endl;
cin>>d[i].ID;
cout<<"please enter the students grade:"<<endl;
cin>>d[i].grade;

}//function that gets info


}
void printstudent (cow d[])
{
int i;
cout<<"students first name"<<" "<<"students last name"<<" "<<"students
ID"<<" "<<"students grade"<<endl;
for(i=0; i<4; i++)
{
cout<<d[i].firstname<<" "<<d[i].lastname<<" "<<d[i].ID<<"
"<<d[i].grade<<endl;
}

}//funtion that prints info

((((((((((((((((((((((((((((((((((((((

/*********************************************************************/
/*Collin Dailey */
/*B3 */
/*3/23/17 */
/*Structure Student */
/*Asks for 3 students first names, last names, ID, and students grade*/
/*********************************************************************/

#include <cstdlib>
#include <iostream>

using namespace std;

class koalaobj{

private: //declare private class


string name;
int age;//determine age age
int ID;
public:
void setdata(int d, string a, int b)
{
age = d;
name=a;
ID=b;

}
void showdata()//void function
{
cout<<name<<endl;
cout<<ID<<endl;
cout<<age<<endl;
}
};
int main(int argc, char *argv[])
{
koalaobj s1;//public class
int age;
int ID;
string john;
int grade;

cout<<"students name: "<<endl; //tell students name


cin>>john;
cout<<"student ID: "<<endl; //students ID
cin>>ID;
cout<<"students age: "<<endl; //students age
cin>>age;

s1.setdata(age, john, ID);

s1.showdata();

system("PAUSE");
return EXIT_SUCCESS;
}

Vous aimerez peut-être aussi