1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

can anyone help me with this code...

Discussion in 'C++' started by sankari, Apr 14, 2008.

  1. sankari

    sankari Banned

    Joined:
    Feb 15, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    this is just the begining of a small project. i'm trying to get name and marks of a student usign struct.
    Code:
    #include <iostream>
    #include <stream>
    #include <sstream>
    using namespace std;
    
    
    struct progress_report
    {
       string names;
       float mark;
    } student;
       
      
      
      
    getnam (string nam,float score)
    {
      string nam;
      float score;
      
      cin >> "Enter your name";
      getline(cin,nam);
      progress_report.names=nam;
      cin >>"Enter your mark";
      getline(cin,score);
      progress_report.mark=score;
      return (progress_report.names,progress_report.mark);
    }
     
      
    int main()
    
    {
      string n;
      float mk;
      getnam(n,mk);
      
      cout << "name is " << n;
      cout << "mark is " << mk;
      return 0;
     }
     
    Last edited by a moderator: Apr 14, 2008

Share This Page