j_007's Profile User Rating: -----

Reputation: -1 Dishonored
Group:
Members
Active Posts:
17 (0.05 per day)
Joined:
06-July 12
Profile Views:
102
Last Active:
User is offline Feb 23 2013 08:32 AM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Nintendo
Your Car:
Mitsubishi
Dream Kudos:
0
Icon   j_007 has not set their status

Posts I've Made

  1. In Topic: code to count number of student who passed and the min avarage

    Posted 22 Feb 2013

    Mr jim,

    i tried to make a new function that

    access avg in my code


    void student::get_avg(int a){
    	avg=a;
    	
    }
    
    
    


    but in the main

    i could not imagine the code that

    will compare and find the lowest avarage
  2. In Topic: code to count number of student who passed and the min avarage

    Posted 22 Feb 2013

    Mr Jim

    i compiled the code

    without this one :

    int min=y;
    
    for(i=0;i<5;i++){
    st1[i].avg;
    
    
    }
    


    but i have no error

    and the output is right


    now i want code to print the student who has lowest avarage
  3. In Topic: code to count number of student who passed and the min avarage

    Posted 22 Feb 2013

    # include<iostream>
    # include<string>
    using namespace std;
    
    class student{
    	string name;
    	int avg;
    public:
    	void set(string n,int a);
    	void get(string &n,int &a);
    	
    };
    void student::set(string n,int a){
    	name=n;
    	avg=a;
    }
    
    void student::get(string &n,int &a){
    	n=name;
    	a=avg;
    }
    
    
    
    //****************************************88888
    void main(){
    	student st1[5];
    	string x;
    	int y;
    
    	
    
    	for(int i=0;i<5;i++){
    		cin>>x>>y;
    		st1[i].set(x,y);
    	}
    
    	cout<<endl;
    
    	for(i=0;i<5;i++){
    		st1[i].get(x,y);
    		cout<<x<<"   "<<y;
    
    	}
    cout<<endl;
    
    
    	for(i=0;i<5;i++){
    		st1[i].get(x,y);
    		if (y<80)
    			cout<<"Students who below 80"<<x<<endl;
    	}
    int count;
    
    for(i=0,count=0;i<5;i++) {
    	st1[i].get(x,y);
    
       if(y > 50)
          count++;
       //if you need a list of passing or failing students
       //you should print it out, with code in here 
    }
    cout<<"Student who passed exam"<<count<<endl;
    cout<<endl;
    
    int min=y;
    
    for(i=0;i<5;i++){
    st1[i].avg;
    
    
    }
    
    
    }
    


    the error is
    'avg' : cannot access private member declared in class 'student'
  4. In Topic: code to count number of student who passed and the min avarage

    Posted 22 Feb 2013

    Ok

    there is a second code i need it :

    is for type name of student who has lowest avarage...

    so first of all

    i should initialize

    variable to first student in the array

    seems to be like this :
    int min=st1[0].avg
    


    but the compilation is error

    because avg is private

    so what can i do to print the student who has lowest avarage
  5. In Topic: code to count number of student who passed and the min avarage

    Posted 22 Feb 2013

    View PostAdak, on 22 February 2013 - 08:11 AM, said:

    The idea is to run through all your students grades, (perhaps like this), and count up the number at or above the passing grade. In pseudo code:

    for(i=0,passingNumber=0;i<numberOfStudents;i++) {
       if(student of i's grade >= passingScore)
          passingNumber++;
       //if you need a list of passing or failing students
       //you should print it out, with code in here 
    }
    
    


    Take it step by step:

    1) Verify that you are working with the correct data - just a temporary print of the students data being looked at, inside the for loop, will do that.

    2) Verify that your variable for the passingScore is also OK. Again, just a temporary print out of it, will do.

    3) Remember to set passingNumber to zero before you start counting - a common oversight.

    The number of students minus the number of passed students equals the number of failed students, is an equation that can help test your code for accuracy.



    wow thanks man this code is working

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Jordan_Amman
Full Name:
Fares
Programming Languages:
VB6

Contact Information

E-mail:
Click here to e-mail me
MSN:
MSN  j_007-007@hotmail.com
Website URL:
Website URL  http://www.jordan-explorer.com
Facebook:
http://www.facebook.com/FaReS.J007

Friends

j_007 hasn't added any friends yet.

Comments

j_007 has no profile comments yet. Why not say hello?