C++ CODE
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<math.h>
#include<iomanip>
int randNum(int min, int max);
using namespace std;
int main()
{
//random number seed
srand(time(NULL));
//array variables
double V[4][5];
double I[4][5];
double PH[4][5];
double P[4][5];
double Q[4][5];
double bill[4][5];
double C[4][5];
double New_bill[4][5];
double rate;
double PF;
int i,j; //for looping
//initializing v
for(i=0; i<4; i++)
{
for(j=0; j<5; j++){
V[i][j]=randNum(100, 1000);
//calling randNum()
}
}
//initializing I
for(i=0; i<4; i++)
{
for(j=0; j<5; j++){
I[i][j]=randNum(10, 50);}
}
//calculating PH
for(i=0; i<4; i++)
{
for(j=0; j<5; j++){
PH[i][j]=randNum(0, 45) *
(22/1260);}
}
//calculating Power vector
for(i=0; i<4; i++)
{
for(j=0; j<5; j++){
P[i][j] = V[i][j] * I[i][j] *
cos(PH[i][j]);}
}
//calculating reaction vector
for(i=0; i<4; i++)
{
for(j=0; j<5; j++){
Q[i][j] = V[i][j] * I[i][j] *
sin(PH[i][j]);}
}
cout<<"Enter rate for bill calculation: ";
cin>>rate;
//calculating bill
for(i=0; i<4; i++)
{
for(j=0; j<5; j++)
{
bill[i][j] = rate * V[i][j] *
I[i][j] ;}
}
cout<<"\n\nEnter Power factor: "; //inputting PF
from user
cin>>PF;
//calculating shunt capacitor and new bill
for(i=0; i<4; i++)
{
for(j=0; j<5; j++)
{
C[i][j] = (Q[i][j] - P[i][j] *
tan(acos(PF))) / (377 * pow(V[i][j], 2));
New_bill[i][j] = sqrt(pow(P[i][j],
2) + (Q[i][j] - P[i][j] *
tan(acos(PF)))*(Q[i][j]-P[i][j]*tan(acos(PF))));
}
}
//printing all the values
cout<<"Power vector reaction vector Bill Shunt
Capacitor New Bill\n\n"; //header
for(i=0; i<4; i++)
{
for(j=0; j<5; j++)
cout<<P[i][j]<<setw(15)<<Q[i][j]<<setw(20)<<bill[i][j]<<setw(20)<<C[i][j]<<setw(17)<<New_bill[i][j]<<"\n";
//data
}
}
//randNum() function
int randNum(int min, int max)
{
return (min + (rand() % (max - min + 1)));
}
OUTPUT
Write a C++ program that creates the following eight two dimensional random number vector: (a) the...
Write the Code in C program. Create a random password generator that contains a user-specified number of characters. Your program should prompt the user for the desired length of the password. Length of password: To create your password, use the random number generator in the stdlib.h C library. To generate random numbers, you will need the srand() and rand() functions. srand(seed) is used to "seed" the random number generator with the given integer, seed. Prompt the user for the seed...
c++ help
Write a program that: Creates two finite arrays of size 10 These arrays will serve as a storing mechanism for student grades in Classes A and B Uses a loop to populate the arrays with randomly generated numbers from 0 to 100.These numbers will represent student grades. Compute average grade of each class. Finally, output the two arrays and the message with two averages and best class. ("Class A average is: 65.43; class B average is: 68.90. Class...
Write a C++ program that uses a structure to store the following inventory information in a file: ⦁ Item description, Quantity on hand, Wholesale cost, Retail cost, and Date added to inventory. ⦁ Use a char array for item description and date. ⦁ The program should have a menu that allows the user to perform the following tasks: i. Add a new record at the end of the file. ii. Display any record in the file. iii. Change any record...
Please, I need help with program c++. This is a chutes and ladders program. The code must be a novel code to the specifications of the problem statement. Thank you very much. Assignment Overview This program will implement a variation of the game “chutes and ladders” or “snakes and ladders:” https://en.wikipedia.org/wiki/Snakes_and_Ladders#Gameplay. Just like in the original game, landing on certain squares will jump the player ahead or behind. In this case, you are trying to reach to bottom of the...
For this c++ assignment, Overview write a program that will process two sets of numeric information. The information will be needed for later processing, so it will be stored in two arrays that will be displayed, sorted, and displayed (again). One set of numeric information will be read from a file while the other will be randomly generated. The arrays that will be used in the assignment should be declared to hold a maximum of 50 double or float elements....
Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate the number of test scores the user enters; have scores fall into a normal distribution for grades -Display all of the generated scores - no more than 10 per line -Calculate and display the average of all scores -Find and display the number of scores above the overall average (previous output) -Find and display the letter grade that corresponds to the average above (overall...