Question
WRITE AN INTERACTIVE PROGRAM that allows the user to enter (at least two)....UP-TO 15 vectors that are to be added........display the resultant on the screen
WRITE AN INTERACTIVE PROGRAM
that allows the user to enter (at least two)....UP-TO 15 vectors that are to be added........display the resultant on the screen
study in your text the if statement
[use the if statement to make sure the user only enteres between two and 15 vectors] **Comments all the line
use
one of my friend did it like below, i think all patterns are good here, but professor asked to use if statement to make sure the user only enteres between two and 15 vectors...so need to fix it...
/* Dweep Dey Program 6 02/27/17 This program add up to fifteen vectors from a text file */
using namespace std;
#include
//global variables ifstream Infile; float rdir, rlength, a, endtheta, magnitude, resdir, len, the,sum;
//functiony goodness float calcvector(float length, float theta); float length [15], theta [15]; void getdata();
int main() { float length, theta; //local variables cout<<"I wrote this to show the addition of vectors in a text file...''"< system;"pause"; //so we can see the equation printed on the screen above return 0; // ends program } void getdata() { int i, numberofdatas; Infile.open("thedata.txt"); i = 0; while(!Infile.eof()) //while not the end of the file { Infile>>length[i]; // cout< ***We cannot use void get data under int main(), however he did its good Thank you.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started