Where is error in my code? Plz locate?
#include <iostream> using namespace std; class result { private: int rno; int marks[3]; //for storing marks char name[50]; //for storing names public: void input() { cout<<"Enter rno:"; cin>>rno; cout<<"Enter name"; gets(name); //for loop for storing values in marks for(int i=0; i<3; i++){ cout<<"Enter marks of 3 subjects:\n"; cin>>marks[i]; } void show() { cout<<"Roll No.:"<<rno<<endl; cout<<"Name:"<<name<<endl; for(int i<0; i<3; i++) cout<<"Marks["<<i<<"]"<<marks[i]<<endl; } int total() { int t=0; for(int i=0; i<3; i++) t=t + marks[i]; return t; } float avg(){ for(int i=0; i<3; i++) t=t+marks[i]; return t/3.0; } }; int main(){ result r; r.input(); r.show(); cout<<"Total is"<<r.total(); cout<<"Average is"<<r.avg(); return 0; }