#include <iostream>
using namespace std;
class Student
{
public:
void Identity(char name[100], int id){
cout<< name<<" "<<id<<endl;
}
void Identity(int id,char name[100]){
cout<< name<<" "<<id<<endl;
}
};
int main()
{
char name[100];
int id;
cin >> name >> id;
Student s1;
s1.Identity(name, id);
cin >> id >> name;
s1.Identity(id, name);
return 0;
}
using namespace std;
class Student
{
public:
void Identity(char name[100], int id){
cout<< name<<" "<<id<<endl;
}
void Identity(int id,char name[100]){
cout<< name<<" "<<id<<endl;
}
};
int main()
{
char name[100];
int id;
cin >> name >> id;
Student s1;
s1.Identity(name, id);
cin >> id >> name;
s1.Identity(id, name);
return 0;
}
NOT 100%
ReplyDeletepl help its not 100 %
ReplyDeleteit working at 77% only
ReplyDeletethis works
ReplyDelete#include
#include
using namespace std;
class Student{
public:
void Identity(int id,char name[100]);
void Identity(char name[100],int id);
void Identity(char name[100],char id[100]){
char temp[100];
if(isdigit(name[0])) {
strcpy(temp,name);
strcpy(name,id);
strcpy(id,temp);
}
cout<>name;
cin>>id;
s1.Identity(name,id);
cin>>name;
cin>>id;
s1.Identity(name,id);
}
courtesy of the pull request on the repo https://github.com/chilloutwithanas/E-Lab-Object-Oriented-Programming/
by user Purukitto over here: https://github.com/chilloutwithanas/E-Lab-Object-Oriented-Programming/pull/30/commits/711422513d3b4bdda89708f9095413867d297c6f#diff-171cd36d686896c35fdb0c023a369584R1
pl update its not working 100%
ReplyDelete#include
ReplyDeleteusing namespace std;
class Student
{
public:
void Identity(char name[100], int id)
{
cout<<name<<" "<<id<<endl;
}
void Identity(int id, char name[100])
{
cout<<name<<" "<<id<<endl;
}
};
int main()
Delete{
char name[100];
int id;
cin>>name>>id;
Student s1;
s1.Identity(name, id);
cin>>id>>name;
s1.Identity(id, name);
return 0;
}
This works
Delete#include
ReplyDeleteusing namespace std;
class TestClass{
public:
class Student
{
public:
void identity(char name[100], int id){
cout<>name>>id;
s1.identity(name, id);
cin>>id>>name;
s1.identity(id, name);
return 0;
}
works 100%