By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,440 Members | 1,436 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,440 IT Pros & Developers. It's quick & easy.

Slove that problem

P: 1
Write a simple structure named Students. This structure consists of three variables Name, GPA and TotalMarks. Now write three variables of data type Students. Get value from user for these three students and show them on screen.
May 26 '07 #1
Share this Question
Share on Google+
2 Replies


Savage
Expert 100+
P: 1,764
Write a simple structure named Students. This structure consists of three variables Name, GPA and TotalMarks. Now write three variables of data type Students. Get value from user for these three students and show them on screen.
Nice problem u ot here.

What have u done so far?

PS:Please read posting guidelines.

Savage
May 26 '07 #2

nemisis
P: 64
Write a simple structure named Students. This structure consists of three variables Name, GPA and TotalMarks. Now write three variables of data type Students. Get value from user for these three students and show them on screen.

here is how u write a structure

Expand|Select|Wrap|Line Numbers
  1. Struct inventory
  2. {
  3. float price_per_unit;
  4. }item1,item2; // object(data type) of structure which can be written in the main() too
To get values from a user

Expand|Select|Wrap|Line Numbers
  1. int main()
  2. {
  3. cout<< "Enter the values of item1";// get values from users
  4. cin>> item1.price_per_unit<< endl;
  5.  
  6. cout<< "Enter the values of item2";
  7. cin>> item2.price_per_unit<< endl;
  8.  
  9. cout<<"Price of item1 is"<<item1.price_per_unit <<"and price of item2 is"<<item2.price_per_unit<<endl; // print values on screen
  10.  
  11. return 0;
  12. }
if u are doing C then instead of cout use printf and instead of cin use scanf, and dont forget to include the respective libraries.
May 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.