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

C++ program Create a table using a 40x5 array of doubles and make sure each colu

ID: 3575048 • Letter: C

Question

C++ program

Create a table using a 40x5 array of doubles and make sure each column has a title. Also have the program write the data to a text file. Use the same titles as the table below, the tables should look the same or at least very similar to each other. The numbers do not have to be the same. Remember this is a C++ program.

f (Hz) Vs p-p (V) | EXRVo p-p Theoc | ExpAv(dB) Av(dB 100 10 0.00482 0.00000 0.01926 0.00000 10 0.04321 0.00000 400 0.07653 0.00000 500 44 0.11 89y 0.13657 0.23024 0.27532 531 0.33535 0.41723 1000 9.375 0.45757 0.56057 2000 8.125 1.59701 1.80353 3000 6.875 301030 3.25455 4000 5781 443697 4.75994 5000 577236 6.02060 6000 4.375 6.989/0 778044 3.594 9.09080 888844 10000 10.83184 10.54780 20000 1.5 16.47817 30000 1.062 20.04321 19.47751 40000 0.8125 22.52313 21.80353 50000 0.6875 2445258 60000 0.5312 26.03144 -25.49484 80000 0.4062 28.52548 27.82520 100000 0.3438 3046148 29.27388 - 071354000 0000 7237354044 2-8 U000 5 3 2 5 559644 08 7-8 7 34453 0000_6 5 7 0 3 4 90000 3 7-1 6 0 5 5 2-8-8 47705927 001245-8 2 7 01-8 5 4 4 82482 00001 069-3579 OOOO-0 0 0 0 1 3 4-6 7-8 1122222 4113-8 26-1 3 9 4 5 7 107600 8-8 2-5 44 CO CL 2 5 9 2 3 5 0 3 9 378 OB 14332151 4936-8 0 5 7 706290 ed 0147-335913 37425326 h r( 0000-1 2 3 4 504 90 85054054 TA 0-0 0 0 0 0 0 0 1 3 4 569 060 4-6-8-0 11222223 4-8-1 5 5 5 1 549 55228 27-63 o) 00004 3727-8 7-9-6-5-6 1-8 3-0 4 8653-1-8 7 5359 86543 9999-8-6 5 43 0-0-0-0-0-0-0-0-0-0-0 |0-0-0-0-0-0-0-0-0-0-0 00 0000000 0000 00 0-0-0-0-0-0-0 0000000 0-0 1234578 1234568 0000000 5-6-00) T 2 3 1234568

Explanation / Answer

#include<bits/stdc++.h>
using namespace std;


int main(int argc, char const *argv[])
{
  
   double arr[40][5];

   for (int i = 0; i < 40; ++i)
   {
       for (int j = 0; j < 5; ++j)
       {
           if(j==0)
           {
               arr[i][j]=(i+1)*100;
           }
           else if(j==1)
           {
               arr[i][j]=10;
           }
           else if(j==2)
           {
               arr[i][j]=rand()%10+0.345;
           }
           else if(j==3)
           {
               arr[i][j]=(rand()%30+0.12)-60;
           }
           else
           {
               arr[i][j]=arr[i][j-1]-1;
           }
          
       }

   }
   ofstream f("out.txt");

   f<<"f(HZ) Vsp -pv(V) Exp Vo p-p(V) TheorAv(dB) ExpAv(dB) ";
   for (int i = 0; i < 40; ++i)
   {
       for (int j = 0; j < 5; ++j)
       {
           f<<arr[i][j]<<" ";
       }
       f<<endl;

   }
   return 0;
}

==================================================================

out.txt

f(HZ)   Vsp -pv(V)   Exp Vo p-p(V)   TheorAv(dB)   ExpAv(dB)
100       10       3.345       -43.88       -44.88      
200       10       7.345       -34.88       -35.88      
300       10       3.345       -34.88       -35.88      
400       10       6.345       -47.88       -48.88      
500       10       9.345       -58.88       -59.88      
600       10       2.345       -52.88       -53.88      
700       10       0.345       -40.88       -41.88      
800       10       3.345       -43.88       -44.88      
900       10       0.345       -53.88       -54.88      
1000       10       2.345       -43.88       -44.88      
1100       10       1.345       -51.88       -52.88      
1200       10       7.345       -50.88       -51.88      
1300       10       2.345       -39.88       -40.88      
1400       10       2.345       -46.88       -47.88      
1500       10       7.345       -34.88       -35.88      
1600       10       9.345       -47.88       -48.88      
1700       10       2.345       -41.88       -42.88      
1800       10       9.345       -32.88       -33.88      
1900       10       3.345       -43.88       -44.88      
2000       10       1.345       -37.88       -38.88      
2100       10       9.345       -56.88       -57.88      
2200       10       1.345       -30.88       -31.88      
2300       10       4.345       -52.88       -53.88      
2400       10       8.345       -45.88       -46.88      
2500       10       5.345       -59.88       -60.88      
2600       10       3.345       -43.88       -44.88      
2700       10       1.345       -39.88       -40.88      
2800       10       6.345       -56.88       -57.88      
2900       10       2.345       -39.88       -40.88      
3000       10       6.345       -58.88       -59.88      
3100       10       5.345       -44.88       -45.88      
3200       10       4.345       -32.88       -33.88      
3300       10       6.345       -54.88       -55.88      
3400       10       6.345       -50.88       -51.88      
3500       10       3.345       -42.88       -43.88      
3600       10       4.345       -44.88       -45.88      
3700       10       2.345       -44.88       -45.88      
3800       10       4.345       -32.88       -33.88      
3900       10       4.345       -45.88       -46.88      
4000       10       3.345       -39.88       -40.88      

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote