I have tried many times but I do able to solve my problem.
please write me how can i begin with structure and cin.getline
for three data(name,gender and age)
the sorting part is simple I try it by bible sort .
std::cout << "Insert some other text" << std::endl;
getline(cin, nonMemberString);
this will store the hard coded string "Some text" into the non member string nonMemberString and print it out, and then will get user input with getline.
std::cout << "Insert some other text" << std::endl;
getline(cin, nonMemberString);
this will store the hard coded string "Some text" into the non member string nonMemberString and print it out, and then will get user input with getline.
std::cout << "Insert some other text" << std::endl;
// ... now it should be evident how to use getline
return0;
}
Compare the two and you will sort things out in a blink.
*********************************************
Please help me I have try As i can but I solve some part from your explanation help me so much
and it is here
#include<iostream.h>
struct student{
char name[20];
char gender;
float cgpa;
};
void main()
{
student data[20];
for(int i=0;i<20;i++)
{
cout<<"enter student name"<<i+1<<endl;
cin>>data[i].name;
cout<<"enter student gender"<<i+1;
cin>>data[i].gender;
cout<<"enter student cgpa"<<i+1;
cin>>data[i].cgpa;
}
}
please I will submitt it tomorrow
so I have to oirder it now
thank you
I have been working on it for thee days but I do not come across my broblem
Please help me by writing full program how can I order with respect to students name or CGPA depending on the user interest I try it like this.
#include<iostream.h>
struct student{
char name[20];
char gender;
float cgpa;
};
void main()
{
student data[20];
for(int i=0;i<20;i++)
{
cout<<"enter student name"<<i+1<<endl;
cin>>data[i].name;
cout<<"enter student gender"<<i+1;
cin>>data[i].gender;
cout<<"enter student cgpa"<<i+1;
cin>>data[i].cgpa;
}
}
I have try it so many times and write the following program but it is still not working as i want to program.
please add some mising program to it .
**************************
#include<iostream>
#include<iomanip>
struct student{
char name[20];
char gender;
int cgpa;
};
using namespace std;
int main()
{
student data[4];
student de;
for(int i=0;i<3;i++)
{
cout<<"enter student "<<i+1<<" name :";
cin>>data[i].name;
cout<<"enter student "<<i+1<<" gender :";
cin>>data[i].gender;
cout<<"enter student "<<i+1<<" cgpa :";
cin>>data[i].cgpa;
1 - Don't (repeat: don't) PM for help. I'm not your friend nor your tutor.
2 - Moreover, don't (repeat: don't) ever ask things like "please write for me the full program. ". I was tempted to write on purpose a program full of errors and then send it to you. There's not a single person that has to do you homework except you.
I hope this is clear enough (either it is or not: read the forum rules, all of them)
Also niek_e's signature is a very valid starting point.
Coming back to your program:
1 - Ask specific question. Don't just throw in a piece of code asking things like "How can you sort" or "How can I modify it".
2 - Try something on your own and post it with explanation of what it does and what you expected it to do instead. Include error messages, if any.
3 - If absolutely clueless on where to start, explain what you have considered and why you have discarded that idea(s)
4 - Last but not least: wrap your code in code tags!
Last edited by mrboolf; Nov 25th, 2008 at 7:47 am.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.