Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

x.Hmld use some clarification, When i run this all my percentages are zero% and

ID: 3619092 • Letter: X

Question

x.Hmld use some clarification, When i run this all my percentages are zero% and i don't understand why. If someone could explain it to me i would really appreciate it. I am also wondering if i should have each question as a cout and then have each survey answer read in? Thoughts and opinions would be greatly appreciated.
Thanks for all the hard work...
This is my input file.
1,A,C,B,D,B,A,B,D,C,A
2,B,D,C,A,C,B,A,C,A,B
3,C,A,D,B,B,D,C,B,A,C
4,D,B,A,C,B,C,D,A,A,D
5,B,A,C,A,B,B,C,D,A,B
6,C,C,D,B,C,C,B,D,B,D
7,D,B,A,C,B,A,D,C,D,B
8,A,D,B,D,C,D,A,B,C,A
9,C,D,D,B,B,A,C,B,C,D
10,D,B,A,C,B,C,D,A,C,D
11,A,C,B,D,C,B,A,D,B,A
12,B,A,C,A,B,D,B,C,B,C
13,D,A,D,C,B,D,B,A,C,A
14,A,B,A,D,C,A,C,B,C,D
15,B,C,B,A,B,C,A,D,B,D
16,C,D,C,B,B,B,D,A,C,B
17,D,B,A,D,C,B,A,C,D,B
18,B,C,B,A,D,D,a,C,B,C
19,A,D,C,B,B,C,D,B,D,A
20,C,A,D,C,B,A,B,D,C,A


This is my code
#include <iomanip>
#include <fstream>
#include <iostream>
#include <string>
#include <ctime>

using namespace std;

void showAnswers();
void answers(int,ifstream &);

int main()
{
   char ch;
    string data;
    char input[10][50];
    int j,k,count,num=0;
    //char response;
    char *fileName = new char[10];
    string in;
    ifstream infile;
    ofstream outfile;
    outfile.open("data.csv",ios::app);        //out file where data is going.
      outfile << fixed << showpoint;
    outfile << setprecision(2);
    char dateStr[9];
//   _strdate_s(dateStr);
    printf("The ", dateStr);
          cout << "Baker Data Group" << endl;
        cout << "This program turns data into percentages." << endl;
        cout << "Enter 'Y' or 'y' to continue." <<endl;
        cout << endl;
        cin >> ch;
           //prompt user to enter input file name
    cout << " Enter the input file name: ";
    cin >> fileName;

  
    //open input file
    infile.open(fileName);
    if (!infile.is_open())
    {
        cout << "unable to open the input file.";
        system("pause");
        exit(1);
    }
    infile >> in;
   while(infile)
    {
        j = 0;
            {
         while(in[j]!=',')
                   j++;
         for(k=0;k<10;k++)
             while(in[j]<'A'||in[j]>'D')
              j++;
              input[k][num]=in[j];
              j++;
             }
    num++;
    infile >> in;        
    }
for(int i='A'; i<='D'; i++)
{
    for(k=0;k<10;k++)
    {
            count=0;
    for(j=0;j<num;j++)
       {
               if(input[k][j]==i)
            count++;
       }
    }
      outfile << (char)i << "," << k+1 << "," <<count/num*100. << endl;
}
outfile.close();
showAnswers();
infile.close();
system("pause");
return 0;
}
void answers(int n,ifstream& in)
{
    in.seekg(ios::beg); //get back to the beginning of the file
    int i;
    double val;
    string input;

    for(i=0;i<n-1;i++)
   
    getline(in,input); //go to proper line for a
    in.ignore(5,',');      //ignore to ,
    in.ignore(5,',');     //ignore to ,
    in >> val;
    cout << "A=" << (int)val << "%,";
   

    for(i=0;i<10;i++)
   
     getline(in,input); //go to proper line for b
    in.ignore(5,',');      //ignore to ,
    in.ignore(5,',');     //ignore to ,
    in >> val;
    cout << "B=" << (int)val <<"%,";
   

    for(i=0;i<10;i++)
   
     getline(in,input); //go to proper line for c
    in.ignore(5,',');      //ignore to ,
    in.ignore(5,',');     //ignore to ,
    in >> val;
cout<<"C="<<(int)val<<"%,";
   
for(i=0;i<10;i++)

    getline(in,input); //go to proper line for d
    in.ignore(5,',');      //ignore to ,
    in.ignore(5,',');     //ignore to ,
    in>>val;
    cout<<"D="<<(int)val<<"% ";

}
    
void showAnswers()
   
{
    ifstream infile;
    infile.open("data.csv");
    if (!infile.is_open())
    {
        cout << "unable to open the input file.";
        system("pause");
        exit(1);
    }

   
cout << "A = Yes" << endl;
cout << "B = No" << endl;
cout &lt

Explanation / Answer

x.P5lor="red">please rate - thanks changes are in the red code #include #include #include #include #include using namespace std; void showAnswers(); void answers(int,ifstream &); int main() {    char ch;     string data;     char input[10][50];     int j,k,count,num=0;     //char response;     char *fileName = new char[10];     string in;     ifstream infile;     ofstream outfile;    outfile.open("data.csv",ios::out);        //out file where data is going.       outfile