-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c615000
commit e82997a
Showing
24 changed files
with
466 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include<iostream> | ||
#include<string.h> | ||
using namespace std; | ||
int main(){ | ||
char name[5][30]={ | ||
"rakesh", | ||
"amitABCD","sumitRSTV", | ||
"anujIKLH", | ||
"UditPPPSSah" | ||
|
||
}; | ||
|
||
for(int i=0;i<5;i++) | ||
cout<<name[i][4]<<endl; | ||
return 0; | ||
} | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include<iostream> | ||
using namespace std; | ||
struct student{ | ||
int roll; //10 | ||
char name[30]; // anupam gulati | ||
int marks[3]; // 90,78,56 | ||
int total; | ||
char grade; | ||
}; | ||
|
||
int main(){ | ||
student s[5]; | ||
int i; | ||
for(i=0;i<5;i++) | ||
{ | ||
cout<<"\n Enter roll no :"; | ||
cin>>s[i].roll; | ||
cout<<"\n Enter name :"; | ||
fflush(stdin); | ||
cin.getline(s[i].name,30); | ||
cout<<"\n Enter marks obtained in first subject (100) :"; | ||
cin>>s[i].marks[0]; | ||
|
||
cout<<"\n Enter marks obtained in Second subject (100) :"; | ||
cin>>s[i].marks[1]; | ||
|
||
cout<<"\n Enter marks obtained in Third Subject (100) :"; | ||
cin>>s[i].marks[2]; | ||
} | ||
//processing area | ||
for(i=0;i<5;i++) | ||
{ | ||
|
||
s[i].total = s[i].marks[0]+s[i].marks[1]+s[i].marks[2]; | ||
|
||
float per = s[i].total/3; | ||
|
||
if(per>=90) | ||
s[i].grade = 'A'; | ||
if(per<90 && per>=80) | ||
s[i].grade='B'; | ||
if(per<80) | ||
s[i].grade ='C'; | ||
} | ||
|
||
// // output phase | ||
for(i=0;i<5;i++){ | ||
|
||
cout<<"\n Roll No :"<<s[i].roll; | ||
cout<<"\n Name :"<<s[i].name; | ||
cout<<"\n Grade :"<<s[i].grade; | ||
cout<<endl; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// call by reference method | ||
|
||
|
||
#include<iostream> | ||
#include<string.h> | ||
using namespace std; | ||
struct student{ | ||
int roll; | ||
char name[30]; | ||
char fname[30]; | ||
}; | ||
|
||
void change_data(student &r){ | ||
r.roll= 10; | ||
strcpy(r.name,"rakesh"); | ||
strcpy(r.fname,"sudarshan Sharma"); | ||
} | ||
|
||
int main(){ | ||
|
||
student s={10,"Swapnil","R.K. Sharma"}; | ||
|
||
cout<<"\n Roll :"<<s.roll; | ||
cout<<"\n Name :"<<s.name; | ||
cout<<"\n Father Name" <<s.fname; | ||
|
||
change_data(s); | ||
|
||
|
||
cout<<"\n Roll :"<<s.roll; | ||
cout<<"\n Name :"<<s.name; | ||
cout<<"\n Father Name" <<s.fname; | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// structure as a function parameter | ||
|
||
|
||
#include<iostream> | ||
#include<string.h> | ||
using namespace std; | ||
struct student{ | ||
int roll; | ||
char name[30]; | ||
char fname[30]; | ||
}; | ||
|
||
void change_data(student r){ | ||
r.roll= 20; | ||
strcpy(r.name,"rakesh"); | ||
strcpy(r.fname,"sudarshan Sharma"); | ||
} | ||
|
||
int main(){ | ||
|
||
student s={10,"Swapnil","R.K. Sharma"}; | ||
|
||
cout<<"\n Roll :"<<s.roll; | ||
cout<<"\n Name :"<<s.name; | ||
cout<<"\n Father Name" <<s.fname; | ||
|
||
change_data(s); | ||
|
||
|
||
cout<<"\n Roll :"<<s.roll; | ||
cout<<"\n Name :"<<s.name; | ||
cout<<"\n Father Name" <<s.fname; | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main(){ | ||
int x; | ||
cout<<x; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include<iostream> | ||
#include<string.h> | ||
using namespace std; | ||
struct student{ | ||
int roll; | ||
char name[30]; | ||
float fees; | ||
char grade; | ||
char std[10]; | ||
}; | ||
|
||
int main() | ||
{ | ||
|
||
student s; | ||
// initialise structure variable | ||
cin>>s.roll; | ||
cin>>s.name; | ||
cin>>s.fees; | ||
cin>>s.grade; | ||
|
||
cout<<s.roll<<endl; | ||
cout<<s.name<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include<iostream> | ||
#include<string.h> | ||
using namespace std; | ||
struct student{ | ||
int roll; | ||
char name[30]; | ||
float fees; | ||
char grade; | ||
char std[10]; | ||
}; | ||
|
||
int main() | ||
{ | ||
student s={10,"saurabh sethi",2350.50,'B'}; | ||
student r; | ||
|
||
//requirement - Initial R using S only | ||
//method -1 | ||
r.roll = s.roll; | ||
strcpy(r.name , s.name); | ||
r.fees = s.fees; | ||
r.grade = s.grade; | ||
|
||
cout<<r.roll<<endl; | ||
cout<<r.name<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include<iostream> | ||
#include<string.h> | ||
using namespace std; | ||
struct student{ | ||
int roll; | ||
char name[30]; | ||
float fees; | ||
char grade; | ||
char std[10]; | ||
}; | ||
|
||
int main() | ||
{ | ||
student s={10,"saurabh sethi",2350.50,'B'}; | ||
student r; | ||
|
||
//requirement - Initial R using S only | ||
//method -1 | ||
|
||
r=s; | ||
|
||
cout<<"copied Roll :"<<r.roll<<endl; | ||
cout<<"copied name : "<<r.name<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include<iostream> | ||
#include<string.h> | ||
using namespace std; | ||
struct student{ | ||
int roll; | ||
char name[30]; | ||
float fees; | ||
char grade; | ||
char std[10]; | ||
}; | ||
|
||
int main() | ||
{ | ||
|
||
student s; | ||
// initialise structure variable | ||
s.roll=10; | ||
strcpy(s.name,"saurabh"); | ||
s.fees = 1234.56; | ||
s.grade='A'; | ||
|
||
cout<<s.roll<<endl; | ||
cout<<s.name<<endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include<iostream> | ||
using namespace std; | ||
struct address{ | ||
char houseNo[10]; | ||
char society[20]; | ||
char area[20]; | ||
char locality[30]; | ||
char city[20]; | ||
char state[20]; | ||
char country[100]; | ||
}; | ||
|
||
struct date{ | ||
int day; | ||
int month; | ||
int year; | ||
}; | ||
struct student{ | ||
int roll; | ||
char name[30]; | ||
address add; | ||
date dob; | ||
}; | ||
int main(){ | ||
student s; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include<iostream> | ||
using namespace std; | ||
struct address{ | ||
char houseNo[10]; | ||
char society[20]; | ||
char area[20]; | ||
char locality[30]; | ||
char city[20]; | ||
char state[20]; | ||
char country[100]; | ||
}; | ||
|
||
struct date{ | ||
int day; | ||
int month; | ||
int year; | ||
}; | ||
struct student{ | ||
int roll; | ||
char name[30]; | ||
address add; | ||
date dob; | ||
}; | ||
int main(){ | ||
student s; | ||
|
||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// structure as a function parameter | ||
|
||
|
||
#include<iostream> | ||
using namespace std; | ||
struct student{ | ||
int roll; | ||
char name[30]; | ||
char fname[30]; | ||
}; | ||
void print_data(student r){ | ||
cout<<"\n Roll :"<<r.roll; | ||
cout<<"\n Name :"<<r.name; | ||
cout<<"\n Father Name" <<r.fname; | ||
} | ||
|
||
int main(){ | ||
student s={10,"Swapnil","R.K. Sharma"}; | ||
print_data(s); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include<iostream> | ||
using namespace std; | ||
struct student{ | ||
int roll; | ||
char name[30]; | ||
char fname[30]; | ||
char address[100]; | ||
char phone[15]; | ||
char email[80]; | ||
char website[100]; | ||
int mark[3]; | ||
int total; | ||
char grade; | ||
char std[10]; | ||
char session[20]; | ||
|
||
}; | ||
void print_data(int x, char y[],char add[],char ph[]){ | ||
cout<<"\n Roll :"<<x; | ||
cout<<"\n Name :"<<y; | ||
} | ||
|
||
int main(){ | ||
student s={10,"Swapnil"}; | ||
print_data(s.roll,s.name); | ||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include<iostream> | ||
using namespace std; | ||
struct student{ | ||
int roll; //10 | ||
char name[30]; // anupam gulati | ||
int marks; // 90 | ||
char grade; // A | ||
}; | ||
int main(){ | ||
student s; | ||
cout<<"\n Enter roll no :"; | ||
cin>>s.roll; | ||
cout<<"\n Enter name :"; | ||
fflush(stdin); | ||
cin.getline(s.name,30); | ||
cout<<"\n Enter marks (100) :"; | ||
cin>>s.marks; | ||
cout<<"\n Enter grade :"; | ||
cin>>s.grade; | ||
|
||
// output phase | ||
|
||
cout<<"\n Roll No :"<<s.roll; | ||
cout<<"\n Name :"<<s.name; | ||
cout<<"\n Marks :"<<s.marks; | ||
cout<<"\n Grade :"<<s.grade; | ||
|
||
return 0; | ||
} |
Oops, something went wrong.