Please let me know if you have any doubts or you want me to modify
the answer. And if you find this answer useful then don't forget to
rate my answer as thumps up. Thank you! :)
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;
double totalResistance(string);
int main()
{
int choice;
string formula;
cout << "*** Welcome to Total
Resistance Calculator Program ***" << endl;
cout << "1. Enter circuit formula."
<< endl;
cout << "2. Generate circuit randomly."
<< endl;
cout << "3. Show circuit formula."
<< endl;
cout << "4. Calculate total resistance."
<< endl;
while (choice !=-1)
{
cout << "Your
choice (1-4) : ";
cin >>
choice;
switch(choice)
{
case 1:
cout << "Enter circuit formula: ";
cin >> formula;
break;
case 3:
cout << "Circuit formula is " << formula <<
endl;
break;
case 4:
cout << "Circuit total resistance is " <<
totalResistance(formula) << " ohm" << endl ;
break;
}
}
}
double totalResistance (string tempFormula)
{
double total=0;
double value[8];
char valueOperator[8];
stringstream assignation(tempFormula);
for(int i=0; i<4; i++)
{
assignation >>
value[i];
assignation >>
valueOperator[i];
}
//need to create word counter, and randomize case
for(int i=0; i<4; i++)
{
if(valueOperator[i]==
'/')
{
total += ((value[i]*value[i+1])/(value[i]+value[i+1]));
i++;
}
else
if(valueOperator[i]== '+')
total += value[i];
else if(i==3)
total += value[i];
}
return total;
}
![演| ResistanceCalculator [~/CLionProjects/ResistanceCalculator]-.../main.cpp E Project ▼ *끗 *ー△CMakeLists.txt. 원.main.cpp 兴▶ lll External Libraries using nanespace std; 8double totalResistance(string); 9int main() 10 int choice string formula; 12 Calculator Program endL:l 15 16 17 18 cout << k WeLcome to Total cout 1. Enter circuit formula. endl; cout << 2. Generate circuit randomly. <endl; cout << 3. Show circuit formula.< endl; cout 4. Calculate total resistance. endl; while (choice!-1) cout << Your choice (1-4): cin > choice; switch(choice) 24 25 26 case 1: 28 29 30 cout Enter circuit formula: cin » formula; break; case 3: main Rune ResistanceCalculatorx /Users/swapnil/CLionProjects/ResistanceCalculator/cmake-build-debug/ResistanceCalculator olo Welcome to Total Resistance Calculator Program ook 1. Enter circuit formula 2. Generate circuit randomly Il 3. Show circuit formula 4. Calculate total resistance Your choice (1-4): Your choice (1-4) Enter circuit formula: Your choice (1-4): Your choice (1-4): Circuit formula is 2.0/2.0+3/3.0 Your choice (1-4): Circuit total resistance is 2.5 ohn Your choice (1-4) Q Event Log Build finished in 2 s 26 ms (2 minutes ago 74 chars 14:78 LF; UTF-8; 4 spaces; Context: ResistanceCalculatorp](http://img.homeworklib.com/questions/457b2af0-9454-11eb-94a3-c7db134a7b7f.png?x-oss-process=image/resize,w_560)
Using C++ For a given electrical circuit, composed from a network ofresistors, arranged in parallel and/or...
Using Matlab When several resistors are connected in an electrical circuit in parallel, the current through each of them is given by in=vs/Rnwhere in and Rn are the current through resistor n and its resistance, respectively, and vs is the source voltage. The equivalent resistance, Req, can be determined from the equation 1/Req=1/R1+1/R2+1/R3+.......+1/Rn. The source current is given by is , and the power, Pn, dissipated in each resistor is given by . is=vs/Req, and Pn=vsin. Write a program in...
Problem: Design and write a C language program that can be used to calculate Voltage, Current and Total Resistance for a Series or Parallel or a Series Parallel circuit. The program should display the main menu that contains the three types of circuit calculations that are available and then the user will be prompted to select a circuit first. After the circuit has been selected the program should then display another menu (i.e., a submenu) requesting the necessary data for...
Write this program using C++ , (Rock, Paper, Scissors Game – Page 373) This programming assignment is from the textbook with some slight modifications and clarifications. Here is what I am going to except from you. Your program should include at least the following functions: getComputerGuess(): this function should return a random value generated by the computer using rand function (read more about random numbers in Chapter 3 pages 126 – 128). getUsersChoice(): this function will ask the user to...
Design program so that it correctly meets the program specifications given below. Specifications: Create a menu-driven program that finds and displays areas of 3 different objects. The menu should have the following 4 choices: 1 -- square 2 -- circle 3 -- right triangle 4 -- quit If the user selects choice 1, the program should find the area of a square. If the user selects choice 2, the program should find the area of a circle. If the user...
THIS IS FOR C++ PROGRAMMING USING VISUAL
STUDIO
THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING
#include "pch.h"
#include
#include
using namespace std;
// Function prototype
void displayMessage(void);
void totalFees(void);
double calculateFees(int);
double calculateFees(int bags) {
return bags * 30.0;
}
void displayMessage(void) {
cout << "This program calculates the total
amount of checked bag fees." << endl;
}
void totalFees() {
double bags = 0;
cout << "Enter the amount of checked bags you
have." << endl;
cout <<...
ELT 103 Final Exam Spring 2019 1. A series-parallel circuit is: a. typically combination of series banks and parallel strings c always a combination of series banks in parallel e. always a combination of parallel banks in series. d. usually a combination of series strings and parallel banks. 2. When analyzing resistance in a series-parallel circuit, you start: a. anywhere in the circuit. / b. at the source. c. at the farthest resistor from the source. d. in any parallel...
A) Given An AC circuit in the frequency domain has an impedance Z represented by the vectors E and I 40v 16.87 60 hertz 20° 8.0A B) Determine Step 1: The value of the impedance Z as a complex number in rectangular form. Step 2: The sketch of Z in terms of an equivalent series circuit representation. Step 3: The value of the reactive element of the series equivalent circuit representation Step 4: The value of the admittance Y -...
C++ programming For this assignment, write a program that will act as a geometry calculator. The program will be menu-driven and should continue to execute as long as the user wants to continue. Basic Program Logic The program should start by displaying a menu similar to the following: Geometry Calculator 1. Calculate the area of a circle 2. Calculate the area of a triangle 3. Quit Enter your choice(1-3): and get the user's choice as an integer. After the choice...
Plz give me correct code and screen shots for this question by using SASM !!!!!!!! Implement the following working C++ program in assembler. Submit assembler code and screen shot. #include <iostream> #include <iomanip> using namespace std; // This menu-driven Health Club membership program carries out the // appropriate actions based on the menu choice entered. A do-while loop // allows the program to repeat until the user selects menu choice 4. int main() { // Constants for membership rates const...
Please, I need help, I cannot figure out how to scan variables
in to the function prototypes!
******This is what the program should look like as it runs but I
cannot figure out how to successfully build the code to do
such.******
My code:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <conio.h>
float computeSeriesResistance(float R1, float R2, float R3);
float computeParallelResistance(float R1, float R2, float
R3);
float computeVoltage(int current, float resistance);
void getInputR(float R1, float R2, float R3);
void getInputCandR(int...