Structs

Sort by

recency

|

240 Discussions

|

  • + 0 comments
    #include <cmath>
    #include <cstdio>
    #include <vector>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    
    /*
        add code for struct here.
    */
    struct Student
    {
     int age; 
     string first_name;
     string last_name;
     int standard;
    };
    
    int main() {
        Student st;
        
        cin >> st.age >> st.first_name >> st.last_name >> st.standard;
        cout << st.age << " " << st.first_name << " " << st.last_name << " " << st.standard;
        
        return 0;
    }
    
  • + 0 comments

    struct Student{ int age; string first_name; string last_name; int standard; };

  • + 1 comment
    #include <cmath>
    #include <cstdio>
    #include <vector>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    
    struct Student {
        int age;
        string first_name;
        string last_name;
        int standard;
    };
    int main() {
        Student st;
        cin >> st.age >> st.first_name >> st.last_name >> st.standard;
        cout << st.age << " " << st.first_name << " " << st.last_name << " " << st.standard;
        
        return 0;
    }
    
  • + 0 comments
    #include <cmath>
    #include <cstdio>
    #include <vector>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    
    /*
        add code for struct here.
    */
    struct Student{
        int age;
        string first_name;
        string last_name;
        int standard;
    };
    
    int main() {
        Student st;
        
        cin >> st.age >> st.first_name >> st.last_name >> st.standard;
        cout << st.age << " " << st.first_name << " " << st.last_name << " " 
    		
    		
    		
    		
    		no need to thank me !!! :)
    		
    		
    		
    		
    		
    		
    		
    		
    		
    		
    		
    		<< st.standard;
        
        return 0;
    }
    
  • + 0 comments

    struct Student{ int age; string first_name; string last_name; int standard; //default cons Student(){ this->age=0; this->standard=0; this->first_name=" "; this->last_name=" "; } //parametrized Student(int age,string fname,string lname,int stan){ this->age=age; this->standard=stan; this->first_name=fname; this->last_name=lname; } }; int main() {

    int age,standard;
    string fname,lname;
    cin>>age>>fname>>lname>>standard;
    Student st1(age,fname,lname,standard);
    cout<<st1.age<<" "<<st1.first_name<<" "<<st1.last_name<<" "<<st1.standard<<"\n";
    
    return 0;
    

    }