Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Lv 32,064 points

princess

Favorite Answers5%
Answers560

I am 17 years old. I am from Kerala, India but i live in US now. I speak malayalam. I want to learn Hindi and Tamil. I love eating, sleeping and watching movies. I watch malayalam, hindi, tamil, telegu and english movies.

  • C++. Input file wont work?

    Write a program that reads a file consisting of students test scores in the range 0-200, it should then determine the number of students having scores in each of the following ranges: 0-24, 25-49, 50-74, 75-99, 100-124, 125-149, 150-174, 175-200. Output the score ranges and the number of students. (Run your program with the following input data : 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189.

    And here is my answer

    #include <iostream>

    #include <fstream>

    #include <string>

    using namespace std;

    void initialize(int student[]);

    void getStudent(int category, int student[]);

    void printArray(int category, int student[]);

    int main()

    {

    int category;

    int score;

    int student[maxCategory];

    ifstream infile;

    infile.open("testscore.txt");

    if (!infile)

    {

    cout<<"Cannot open input file. "<< endl;

    return 1;

    }

    initialize(student);

    infile>>score;

    while (!infile.eof())

    {

    category = getCategory(score);

    getStudent(category, student);

    infile>>score;

    }

    infile.close();

    printArray(category, student);

    system("Pause");

    return 0;

    }

    void initialize(int student[])

    {

    int j;

    for (j=0;j<=maxCategory;j++)

    {

    student[j]=0;

    }

    }

    void getStudent(int c, int s[])

    {

    if (c<=maxCategory)

    {

    s++;

    }}

    void printArray(int category, int student[])

    {

    string scoreRange;

    cout<<"Score Range"<<" ";

    cout<<"Number of Student"<<endl;

    for (category=0; category<=maxCategory;category++)

    {

    switch (category)

    {

    case 0:

    scoreRange= "0-24";

    break;

    case 1:

    scoreRange= "25-49";

    break;

    case 2:

    scoreRange= "50-74";

    break;

    case 3:

    scoreRange= "75-99";

    break; case 4:

    scoreRange= "100-124";

    break;

    case 5:

    scoreRange= "125-149";

    break;

    case 6:

    scoreRange= "150-174";

    break;

    case 7:

    scoreRange= "175-200";

    break;

    }

    cout<< scoreRange<<" ";

    cout <<student[category]<<endl;

    }

    }

    int getCategory(int score)

    {

    int scoreRange;

    if (score >=0 && score <25)

    scoreRange=0;

    else if (score >=25 && score <50)

    scoreRange=1;

    else if (score >=50 && score <75)

    scoreRange=2;

    else if (score >=75 && score < 100)

    scoreRange=3;

    else if (score >=100 && score <125)

    scoreRange=4;

    else if (score >=125 && score <150)

    scoreRange=5;

    else if (score >=150 && score <175)

    scoreRange=6;

    else if (score >=175 && score <=200)

    scoreRange=7;

    else

    cout<<"Invalid score";

    return scoreRange;

    }

    2 AnswersProgramming & Design7 years ago
  • C++. Write a program that reads in ten whole numbers?

    Write a program that reads in ten whole numbers and that output the sum of all the numbers greater than zero, the sum of all the numbers less than zero (which will be a negative number or zero), and the sum of all the numbers, whether positive, negative, or zero. The user enters the ten numbers just once each and the user can enter them in any order. Your program should not ask the user to enter the positive numbers and the negative numbers separately.

    Assume the user will type integer numbers.

    this is what i got but it wont run saying there is an error

    #include<iostream>;

    using namespace std;

    int main()

    {

    int count=0;

    int num;

    int positive=0;

    int negative=0;

    do

    {

    cout<<"Enter 10 whole numbers"<<endl;

    cout<<num;

    if (num<=0)

    {

    negative= negative+num;

    }

    else

    {

    positive= positive+num;

    }

    count++;

    }

    while (count<10);

    cout<<" Sum of postive number= "<< positive<<endl;

    cout<<" Sum of negative number= "<<negative<<endl;

    cout<<" Sum of all numbers= " <<positive+ negative<<endl;

    }

    4 AnswersProgramming & Design7 years ago
  • computer science . Please check my work.. Its not really working.?

    Write a program to calculate students’ average test scores and their grades.

    You may assume the following input data:

    Johnson 85 83 77 91 76

    Aniston 80 90 95 93 48

    Cooper 78 81 11 90 73

    Gupta 92 83 30 69 87

    Blair 23 45 96 38 59

    Clark 60 85 45 39 67

    Kennedy 77 31 52 74 83

    Bronson 93 94 89 77 97

    Sunny 79 85 28 93 82

    Smith 85 72 49 75 63

    Use three arrays: a one-dimensional array to store the students’ names, a (parallel) two-dimensional array to store the test scores, and a parallel one dimensional array to store grades. Your program must contain at least the following functions: a function to read and store data into two arrays, a function to calculate the average test score and grade, and a function to output the results. Have your program also output the class average.

    #include<iostream>

    #include<cctype>

    #include<string>

    using namespace std;

    const int numrows=10;

    const int numcol=5;

    int matrix [numrows][numcol];

    void sumrows(int matrix[][numcol],int numrow);

    int main()

    {

    const int Max=10;

    string Name[Max]= {"Johnson","Aniston","Cooper","Gupta","Blair","Clark","Kennedy","Bronson","Sunny","Smith"};

    for (int i=0; i < Max; i++)

    //cout<<Name[i] <<endl; displays names

    const int Rows=10;

    const int Col=5;

    int studentGrades[numrows][numcol]= {{85, 83, 77, 91, 76},

    {80, 90, 95, 93, 48},

    {78, 81, 11, 90, 73},

    {23, 45, 96, 38, 59},

    {60, 85, 45, 39, 67},

    {77, 31, 52, 74, 83},

    {93, 94, 89, 77, 97},

    {79, 85, 28, 93, 82},

    {85, 72, 49, 75, 63}};

    sumrows(studentGrades, numrows);

    cout<<endl;

    return 0;

    }

    void sumRows(int matrix[][numcol],int numrows)

    {

    int row, col;

    int sum;

    for(row=0; row < numrows; row ++)

    {

    sum=0;

    for(col =0; col < numcol; col++)

    sum=sum+matrix[row][col];

    cout<<"average =" <<(row+1)<<sum<<endl;

    }

    }

    1 AnswerProgramming & Design8 years ago
  • C++ programming HW help? Plz?

    Three employees in a company are up for a special pay increase. You are

    given a file, sayCh3_Ex7Data.txt, with the following data:

    Miller Andrew 65789.87 5

    Green Sheila 75892.56 6

    Sethi Amit 74900.50 6.1

    Each input line consists of an employee’s last name, first name, current salary,

    and percent pay increase. For example, in the first input line, the last name of

    the employee is Miller,thefirstnameisAndrew, the current salary is

    65789.87, and the pay increase is 5%. Write a program that reads data from

    the specified file and stores the output in the file Ch3_Ex7Output.dat.

    For each employee, the data must be output in the following form:

    firstName lastName updatedSalary. Format the output of decimal

    numbers to two decimal places

    1 AnswerProgramming & Design8 years ago
  • Laptop Sound problem?

    I can only hear background music and the main sound is very low when i use headphones. The headphone is fine. I use it for other computers and it sound just fine. But on my laptop it doesn't work.

    1 AnswerLaptops & Notebooks8 years ago
  • Bharatanatyam Teacher Plz help me?

    I am doing a presentation on Bharatanatyam. Plz answer these question....

    1. When did you start learning Bharatanatyam?

    2. How many students do you teach?

    3. Do you have a bachelor’s degree? In What?

    4. How long does it take to completely finish Bharatanatyam?

    5. According to you what is the most important quality a Bharatanatyam dancer needs?

    6. What does the Bharatanatyam namashkar mean?

    7. How important is Araimandi in Bharatanatyam?

    8. What is the bells around the legs used for?

    9. Phone #

    2 AnswersTeaching10 years ago
  • Movie Title help????????????

    So the story is something like indian girl meets a white guy. He falls in love with her ( typical). She goes to india. He follows. I dont know the title

    It's not the other end of the line

    3 AnswersMovies1 decade ago
  • Physics help please??????????

    An object is launched from the origin with a velocity of 15.0 m/s at an angle of 45.0 degrees above the horizontal. What is the velocity of the object 2.00 seconds later?

    2 AnswersPhysics1 decade ago
  • Physics help please ?????????

    A horizontal force is applied to a 2.0 kg box. The box starts from rest, moves a horizontal distance of 12.0 meters, and obtains a velocity of 8.0 m/s. The change in the kinetic energy is

    5 AnswersPhysics1 decade ago
  • Physics Urgent please?

    What is the wavelength for an electromagnetic wave with a frequency of 1.150×10^15 Hz?

    2 AnswersPhysics1 decade ago
  • Math Help Please?? Explain the answer too thank you?

    Rationalize the Denominator:-

    2 + square root 3 divided by 2 - square root 3

    Use laws of Exponents:-

    2a –2 divided by (2a) –3

    Complex Numbers:

    Leave in a+bi form

    3+2i divided by 3-2i

    A saline solution is 20% salt. How many gallons of water must be added to dilute the mixture to 8 gals of a 15 % saline solution?

    If sam can do a job in 4 days that lisa can do in 6 days and tom can do in 2 days. How long would the job take if sam, lisa and tom worked together?

    1 AnswerMathematics1 decade ago