Assume I have a table. The values inside the table are determined by y and x variables. But in this case it is t and p (or temperature and pressure). Those values for t and p don't correlate to my array in code ( for example on column = 0 the temperature= -120). That's what a and b are for. I want to be able to input a value between two rows or columns and use a y=mx+b equation to find it.I'm trying to make a linear interpolation from an array code. Yet if I plug in a value in between two coordinates it doesn't solve what is in between. If I give a t=-81.5 for example which is in between -80 and -85, it gives the value corresponding to t=-85. I want to be able to plug i say p=11 and t=-82.4 and get back a value that uses y=mx+b to give back a value from linear interpolation from the values around it. Can someone help me??
#include <iostream>
#include <iomanip>
#include <string >
using namespace std;
int main()
{
int a, b;
int j, i;
float t1, m, p2, p1, w, p,t, a1, a2;
double pt [75][21] =
{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}
,{0,0,0,0,6.67E+27,0,0,-3.18E+28,1.19E+28,0,-4.32E+28,0,-5.53E+28,0,3.69E+28,0,0,8.86E+27,0,0,1.45E+27}
,
{0,0,6.60E+27,0,5.94E+26,0,1.41E+27,0,0,4.35E+27,0,0,0,0,0,1.04E+28,1.87E+27,0,-6.63E+26,0,0},
{0,0,416.239054,297.5463278,216.0356292,159.0293809,118.4963531,89.24049123,67.83433165,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,416.2390569,297.5463293,216.0356301,159.0293814,118.4963534,89.24049141,67.83433176,51.97633661,40.09536551,31.10241936,24.23195309,0,0,0,0,0,0,0,0}
,
{0,0,416.2390853,297.5463446,216.0356386,159.0293863,118.4963563,89.24049313,67.83433282,51.97633728,40.09536594,31.10241963,24.23195327,18.93870556,14.82955365,11.61783264,0,0,0,0,0},
{0,
0,416.23937,297.5464977,216.0357237,159.029435,118.4963849,89.24051038,67.83434343,51.97634393,40.09537018,31.10242238,24.23195507,18.93870675,14.82955445,11.61783318,9.09228946,7.095707654,0,0,0},
{0, 0, 416.242217, 297.5480283, 216.0365744,
159.029922,118.4966713,89.24068284,67.83444952,51.97641045,40.0954126,31.10244983,24.23197307,18.93871869,14.82956243,11.61783857,9.092293108,7.095710134,5.510022088,4.245829534,0},
{0, 0, 416.270689, 297.563336, 216.0450817,
159.0347927, 118.4995352, 89.24240744
,67.83551047, 51.97707567
,40.0958368, 31.10272439,
24.23215309, 18.93883803,
14.82964229, 11.61789239
,9.092329584, 7.095734928,
5.510038952, 4.245840976
,3.234989005},
{0, 0, 416.5556227,
297.7164988, 216.1301923,
159.0835159, 118.5281817,
89.25965712, 67.84612174,
51.98372877 ,40.10007925,
31.10547021,24.23395342, 18.9400316,
14.83044092, 11.6184307,
9.092694356, 7.095982881,
5.510207596, 4.245955397,
3.235066138},
{0, 0, 419.4265617,
299.2568441, 216.9850003,
159.5723952, 118.8154101,
89.43252144 ,67.95241736,
52.05035354, 40.14255322,
31.13295505, 24.2519714,
18.95197549, 14.83843195,
11.62381648, 9.096343673,
7.098463352, 5.511894604,
4.247099937, 3.235837667},
{0, 0, 450.473599,
315.5847697, 225.9202795,
164.631685, 121.7661578,
91.19871514, 69.0339823,
52.72611478, 40.57229368,
31.41049798, 24.43363528,
19.07224772, 14.91881799, 11.67794986,
9.132998341, 7.123363555
,5.528821496, 4.258579221, 3.243573138},
{0, 0, 490.8441882,
335.9514655, 236.7528267,
170.6431099, 125.2215315,
93.24480173, 70.27682486,
53.4978385, 41.06070228,
31.72473919, 24.63870151,
19.207685568, 15.00916266, 11.7386918,
9.174073214, 7.151235676,
5.547751135, 4.271406688,
3.252211382},
{0, 0, 539.1629115,
359.1282804, 248.6764869,
177.1101694, 128.8787328,
95.38480012, 71.56523467,
54.29248548, 41.56101083,
32.04532976, 24.84723764,
19.34505966, 15.10060731, 11.80006821,
9.215518625, 7.179326284,
5.56681045, 4.284311351,
3.260895533},
{0, 0, 598.0332937,
385.7399047, 261.864857,
184.0867059, 132.7559767,
97.62532776, 72.90176456,
55.11109251, 42.07365961,
32.37246406, 25.05933249,
19.48441179, 15.19317216
,11.86208908, 9.257339603,
7.207637955, 5.586000776,
4.297293916, 3.269625957},
{0, 0, 671.3353311,
416.611006, 276.5304225,
191.6353936, 136.8737381,
99.97363877, 74.28916162,
55.95475982, 42.59911089,
32.70634452, 25.27507795,
19.62578498, 15.28687791,
11.92476461, 9.299541287,
7.236173311, 5.605323467,
4.310355083, 3.278403024},
{0, 0, 1734.079798,
694.5290923, 384.081051,
241.0598603, 161.9973836,
113.6413733, 82.10147992,
60.5926155, 45.43630764,
34.48463998, 26.41201146,
20.36456381, 15.77328194,
12.24833478, 9.516446367,
7.382300005, 5.703971204,
4.376865356, 3.323001249},
{0, 0, 0,
2086.233516, 628.5349052,
324.8377781, 198.4172016,
131.6378131, 91.74983911,
66.06867271, 48.67832201,
36.46737505, 27.65600373,
21.16110515, 16.29163028,
12.58993361, 9.743694705,
7.534436648, 5.806142578,
4.445451917, 3.368823454},
{0, 0, 0, 0,
1728.931544, 497.8641337, 255.9611644,
156.4062859, 103.9676811,
72.63273783, 52.41845016,
38.69195445, 29.02292345,
22.0224589, 16.84517661,
12.95111102, 9.982044165
,7.692961749, 5.912029772,
4.516213488, 3.415920673},
{0, 0, 0, 0,
0, 1065.293367, 360.5149078,
192.6551175, 119.939106, 80.64483142,
56.78104254, 41.20550042,
30.53193861, 22.95687085,
17.43763201, 13.3335998,
10.2323285, 7.858286277,
6.021839211, 4.58925515,
3.464346807},
{0, 0, 0, 0,
0, 0, 609.4629605,
250.773991, 141.7078202, 90.64350671,
61.93559736, 44.06822761,
32.20642075, 23.97404757,
18.07324823, 13.73934347,
10.4954671, 8.030857242
,6.135792876 ,4.66468886
,3.514158852},
{0, 0, 0, 0, 0,0,1969.364974,359.1050648,173.1301444,103.4721778,
68.11929589,47.35832945,34.07516416, 25.08549472,
18.75691995, 14.17052927,
10.77247628, 8.211161687,
6.254129844, 4.742634031,
3.565417096},
{0, 0, 0, 0, 0, 0, 0,
632.2069464, 222.4571119, 120.5303974, 75.6745325,
51.17922945, 36.17405559,
26.3049543 ,19.49431102,
14.62962759 ,11.06448237,
8.399731329, 6.377107933, 4.823218153,
3.618185396},
{0, 0, 0, 0,
0, 0, 0,
2639.671992, 311.0890019,
144.3227273, 85.11453187, 55.67065026,
38.54840109, 27.64897556,
20.29201174, 15.11943938,
11.37273706, 8.59714775,
6.505005579, 4.906577504, 3.6725314},
{0, 0, 0, 0,
0, 0, 0, 0,
517.1169261, 179.8175061,
97.24507179, 61.02607034,
41.25623358, 29.13767062,
21.15773638, 15.64315329,
11.69863534, 8.804048428,
6.638123949, 4.992857898,
3.728526882},
{0, 0, 0, 0, 0,
0, 0, 0,
1531.15454, 238.4644703,
113.4075818, 67.52132732, 44.37311923,
30.79572764, 22.10057346,
16.20441518, 12.04373655,
9.021133574, 6.776789316,
5.082215558, 3.786248027},
{0, 0, 0, 0, 0,
0, 0, 0, 0,
353.8789878, 136.0129602,
75.56365953, 47.99931981, 32.65379095,
23.13130603, 16.80741316,
12.40978938, 9.249174074,
6.921355699, 5.174818036,
3.845775782},
{0, 0, 0, 0, 0, 0,
0, 0, 0,
685.7875281, 169.8726937,
85.78052879, 52.27077908, 34.75037228,
24.26282592, 17.45698221,
12.79876151, 9.489020631,
7.072207906, 5.270845279,
3.907196234},
{0, 0, 0, 0, 0,
0, 0, 0, 0,
11042.96616, 226.1770558,
99.19175486, 57.37654604,
37.13454908, 25.51067569,
18.15873411, 13.21287491,
9.741614375, 7.229764947,
5.370490792, 3.970601048},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 338.3062607,
117.5730238, 63.58751317,
39.86985432, 26.89376682,
18.91922006, 13.65464844,
10.00799916, 7.394483931,
5.473962935, 4.036087894},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 670.9062917,
144.3154465, 71.30608143,
43.04002211, 28.43534499,
19.7461357, 14.12694902,
10.28933607, 7.566864447,
5.58148638, 4.103760943},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 39723.93896,
186.8034028, 81.15698678,
46.75770991, 30.16430691,
20.64858253, 14.63305393,
10.58692021, 7.747453708,
5.693303749, 4.173731457},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0,
264.7448646, 94.16546614,
51.17816732, 32.11702881,
21.63740425, 15.17672705,
10.90220081, 7.936852269,
5.809677409, 4.246118379},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0,
454.2841996, 112.1394482,
56.52146544, 34.33995385,
22.72562462, 15.76231252,
11.23680464, 8.135720732,
5.930891548, 4.321048979},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0,
1599.097718, 138.592638,
63.11027115, 36.89333337,
23.92902429, 16.39485108,
11.5925642, 8.344787487,
6.057254523, 4.398659663},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
181.3772584, 71.43752125,
39.85677065, 25.26691103,
17.08022562, 11.97155128,
8.56485754, 6.189101415, 4.47909674},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
262.3702128, 82.29580448, 43.33766881,
26.76316351, 17.82534457,
12.37611731, 8.79682293,
6.326797035, 4.562517373},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
474.0450087, 97.04586092,
47.48452711, 28.44766899,
18.63837569, 12.80894217,
9.041674797, 6.470739291, 4.6490906},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
2453.032795, 118.236817,
52.5086765, 30.35834013,
19.52904668, 13.2730937,
9.300517535, 6.621363019,
4.738998474},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 151.2658858, 58.72144128,
32.54400263, 20.50903611,
13.77210043, 9.57458545,
6.779144372, 4.83243734},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 209.8976462, 66.60121455,
35.06862634, 21.59248861,
14.31004155, 9.865262458,
6.94460585, 4.929619267},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 342.7409483, 76.92289229,
38.01769002, 22.79670179,
14.89165849, 10.17410537,
7.118322075, 5.030773652},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 933.5656741, 91.02970547,
41.5080516, 24.1430568,
15.52249527, 10.50287191,
7.300926461, 5.13614903},
{0, 0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 111.4712533, 45.70380199,
25.65829867, 16.20907562,
10.8535541, 7.493118926,
5.246015109},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 143.7499387,
50.84281109, 27.37633129,
16.95912949, 11.22841867,
7.695674876, 5.360665073},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 202.3377654, 57.28344586,
29.34078428, 17.78188522,
11.63005616, 7.909455586, 5.4804182},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 341.5251341,
65.591933, 31.6087696,
18.68845126, 12.06144071,
8.135420548, 5.605622836},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 1094.142012,
76.71862205, 34.25652594,
19.69232067, 12.526004,
8.374641795, 5.736659728},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0,
92.39024239, 37.38815671,
20.81004695,13.02772673, 8.62832095,
5.873945969},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0,
116.1062038, 41.14964111,
22.06216444, 13.57125273,
8.89780931, 6.017939377},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0,
156.1988344, 45.75224397,
23.47446092, 14.16203347,
9.184632062, 6.169143629},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0,
238.576319, 51.51360631,
25.07977304, 14.80651118,
9.490517107, 6.32811407},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0,
504.7680903, 58.93434126,
26.92057082, 15.51235501,
9.817429792, 6.495464632},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
68.85194551, 29.05277052,
16.28876755, 10.16761538,
6.671875711},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
82.78149639, 31.55151296,
17.14688808, 10.54365045,
6.858103339},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
103.7746434, 34.52020285,
18.10033079, 10.94850664
,7.05499016},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
139.0292374, 38.10517727,
19.165912, 11.38562909, 7.26347801},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
210.5531877, 42.52056695,
20.36465099, 11.85903494,
7.484623115},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
433.6039241, 48.09269824,
21.72316998, 12.37343691,
7.719613948},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 55.34465047, 23.27569497,
12.93440095, 7.969792483},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 65.17086216, 25.0669786,
13.5485482, 8.236680033},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 79.23780068, 27.15668482,
14.22381777, 8.522007982},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 101.0461288, 29.62616308,
14.96981155, 8.827755611},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 139.4121801, 32.58928598,
15.7982539, 9.15619583},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 224.7315854, 36.21050666,
16.7236121, 9.509952019},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 579.1037739, 40.73645179,
17.76394862, 9.892068009},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 46.55457269,
18.94211152, 10.306096},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 54.31039841,
20.28743221, 10.75620733},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 65.16534476,
21.83820022, 11.24733338},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 81.440737,
23.64536625, 11.7853471},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 108.5476488,
25.77824661, 12.3772988},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 162.6912583,
28.33361838, 13.03172703},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 324.5623832, 31.45081246,
13.75907279},
{0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 62791.68001,
35.33799211, 14.57224103}};
cout << "input temp"<< endl;
cin >> t;
cout << "input the pressure"<< endl;
cin >> p;
for (i=0; i<21; i++);
for (j=0; j<75; j++)
{
if (pt[j][i]>= p)
{
p1=pt[j-1][i];
p2=pt[j][i];
break;
}
}
cout<<"p1 ="; cout<<"p2 =";
for( i = 0; i<75; i++)
for(j= 0; j<21; j++)
{
if(pt[i][j]>=t)
{
a1=pt[i][j-1];
a2=pt[i][j];
break;
}
}
cout<<"t1=";
m=(a2-a1)/5;
cout<<"t2="< cout.precision(4);
cout<<"The slope is: "< cin.get();
w=m*(t-i)+t1;
cout<<"The answer is = ";
if(p==5)
{
a = 15;
}
if(p==10)
{
a = 16;
}
if (p==15)
{
a = 17;
}
if (p==20)
{
a=18;
}
if (p==25)
{
a=19;
}
if (p==30)
{
a=20;
}
if (p==35)
{
a=21;
}
if (p==40)
{
a=22;
}
if (p==45)
{
a=23;
}
if (p==50)
{
a=24;
}
if (p==55)
{
a=25;
}
if (p==60)
{
a=26;
}
if (p==65)
{
a=27;
}
if (p==70)
{
a=28;
}
if (p==75)
{
a=29;
}
if (p==80)
{
a=30;
}
if (p==85)
{
a=31;
}
if (p==90)
{
a=32;
}
if (p==95)
{
a=33;
}
if (p==100)
{
a=34;
}
if (p==105)
{
a=35;
}
if (p ==110 )
{
a=36;
}
if (p==115)
{
a=37;
}
if (p==120)
{
a=38;
}
if (p==125)
{
a=39;
}
if (p==130)
{
a=40;
}
if (p==135)
{
a=41;
}
if (p==140)
{
a=42;
}
if (p==145)
{
a=43;
}
if (p==150)
{
a=44;
}
if (p==155)
{
a=45;
}
if (p==160)
{
a=46;
}
if (p==165)
{
a=47;
}
if (p==170)
{
a=48;
}
if (p==175)
{
a=49;
}
if (p==180)
{
a=50;
}
if (p==185)
{
a=51;
}
if (p==190)
{
a=52;
}
if (p==195)
{
a=53;
}
if (p==200)
{
a=54;
}
if (p==205)
{
a=55;
}
if (p==210)
{
a=56;
}
if (p==215)
{
a=57;
}
if (p==220)
{
a=58;
}
if (p==225)
{
a=59;
}
if (p==230)
{
a=60;
}
if (p==235)
{
a=61;
}
if (p==240)
{
a=62;
}
if (p==245)
{
a=63;
}
if (p==250)
{
a=64;
}
if (p==255)
{
a=65;
}
if (p==260)
{
a=66;
}
if (p==265)
{
a=67;
}
if (p==270)
{
a=68;
}
if (p==275)
{
a= 69;
}
if (p==280)
{
a=70;
}
if (p==285)
{
a=71;
}
if (p==290)
{
a=72;
}
if (p==295)
{
a=73;
}
if (p==300)
{
a=74;
}
if (p== 1)
{
a = 11;
}
if (p== 2)
{
a = 12;
}
if (p== 3)
{
a = 13;
}
if (p== 4)
{
a = 14;
}
if (p == 1e-1)
{
a = 10;
}
if (p == 1e-2)
{
a = 9;
}
if (p== 1e-3){
a = 8;
}
if (p== 1e-4)
{
a = 7;
}
if (p== 1e-5)
{
a = 6;
}
if (p== 1e-6)
{
a = 5;
}
if (p== 1e-7)
{
a=4;
}
if (p== 1e-8)
{
a=3;
}
if (p== 1e-9)
{
a =2;
}
if (p== 1e-10)
{
a=1;
}
b=(120+t)/5;
cout<<"the answer is : "<
return 0;
}
Assume I have a table. The values inside the table are determined by y and x...
I have a problem with merging the two linked lists together. In the function AscendMerge, I am trying to compare the values of each node in the two lists and output them into one list in ascended order. Everything works except for the one function. Can someone tell me what im doing wrong, when I run it it skips over values. #include <iostream> #include <cassert> using namespace std; struct nodeType { int info; nodeType *link; nodeType *current;...
Start by using the starter code provided for the Line class. It implements operator overloading so you can use cin/cout with line objects. A line will be made up of two points. Create an object to implement a “line” class which allows the programmer to store a line. This class must use the “point” class developed in Part B. The object should have two constructors, appropriate set/get functions, and overloaded I/O (cin/cout) functions. It should include functions the return the...
C++ Code error help. I am getting the error: "expression must have a constant value, the value of parameter 'n' ( declared at line 7) cannot be used as a constant" I am also getting this error at lines 65 and 66 with m and n. I do not know how to fix this. Here is my code and ive marked where the errors were with lines: #include<iostream> using namespace std; // Function to allocate memory to blocks as per...
Write an assembly program that takes two values, a and b, multiplies them, and then stores the result in c. When the program begins: • a is located in $fp + 1 • b is located in $fp + 2 At the end of the program: • a is located in $fp + 1 • b is located in $fp + 2 • c is located in $fp + 3 In doing this, there must be at least one function,...
Hey, so i am trying to have my program read a text file using a structure but i also want to be able to modify the results(I kinda have this part but it could be better). I cant seem to get it to read the file(all the values come up as 0 and i'm not sure why because in my other program where it wrote to the txt file the values are on the txt file) i copied and pasted...
Have Corporate Sales for 6 divisions and their quarterly sales figures. The issue is the error function where I am unable to have user reinput the same quarterly amount without going to the next quarter input. This has affected the total sales for the company. /***************************************** This program gathers sales information for six divisions and displays the total sales for each division and total company. *****************************************/ #include<iostream> using namespace std; // Classs division sales class DivSales { private: // Variables...
Need help with a C++ program. I have been getting the error "this function or variable may be unsafe" as well as one that says I must "return a value" any help we be greatly appreciated. I have been working on this project for about 2 hours. #include <iostream> #include <string> using namespace std; int average(int a[]) { // average function , declaring variable int i; char str[40]; float avg = 0; // iterating in...
The question I want answered is in C++. How can I pass a value to a function and create a new linked list out of it? For example I have: void getIntegerInput(List<int> list) { int s; std::cout << "Type a positive integer then click enter to add it to the linked list\n"; std::cout << "Type -1 to stop\nType -2 to delete an item from the list\n"; std::cin >> s; while (s != -1) { if (s == -2) { int...
81. The following function call doesn’t agree with its prototype: cout << BoxVolume( 10, 5 ); int BoxVolume(int length = {1}, int width = {1}, int height = {1}); T__ F__ 82. The following function is implemented to swap in memory the argument-values passed to it: void swap(int a, int b) { int temp; temp = a; a = b; b = temp; ...
I have 2 issues with the C++ code below. The biggest concern is that the wrong file name input does not give out the "file cannot be opened!!" message that it is coded to do. What am I missing for this to happen correctly? The second is that the range outputs are right except the last one is bigger than the rest so it will not output 175-200, it outputs 175-199. What can be done about it? #include <iostream> #include...