C++ :: Parabolic Shot Program - Calculate And Graph Time Vs Distance
Nov 13, 2013
It is supposed to calculate and graph time vs. distance. The problem I have is graphing, if I put too small values for Vi, which is the initial velocity, it just graphs one or two points, because t is too small. I already tried to adjust t with 'if(t<10) t=t*10; if (t>100) t=t/10;', But it seems not to solve my problem.
Other truble I have is that, as the graph is parabola, core values are very close together, and when plotted, these values are in the same line on the screen.
Here is my code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main() {
float x, y, hmax, t, amax, vi, v, a, b, g, ang; /*x= x coordinate, y= y coordinate, hmax= maximum height,
I'm working on a Dijkstra's algorithm with a fixed graph. My question is, how should I go about assign distance values to the graph. The user can start from any node.
I'm challenged to write a program which calculates the time difference between two daytime.
compiler doesn't give an error, yet the warning: "format '%d' expects argument of type 'int *', but argument 3 has type 'int' [- Wformat]" for lines 24 and 26
However, by entering the first time the program crashes anyway. so I assume I do really need some pointer to make it read from the console can you see where my problem is?
Code:
#include <stdio.h> #include <stdlib.h> typedef struct { int Second; int Minute; int Hour; }Time;
I'm creating a quick program to calculate midpoint and distance between two points. I'm having a little trouble. This is the program:
//This program is a start to solve basic coordinatre plane distances and midpoints #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> using namespace std; int main(int nNumberofArgs, char* pszArgs[]){ cout << "This is a calculator to find distance and the midpoint between two points. " ;
[Code]...
the problem is that the output for both equations is wrong, it doesn't do the math properly and I assume it has to do with the variable types I'm using but am not sure. P.S. I am using the latest version of DEV-C++
Calculate the Euclidean distance to the origin for each point in parallel on GPU.Assume that for each point i, its coordinate is X[i],Y[i] and given 1000000 points on 2d plane
I'm trying to create a program to calculate the flight time and fuel burn of an airplane. However when I repeated the whole calculation, it did not show any data or result like the previous calculation. In addition, the "If" statement that I used to test the "fuelRemain" doesn't work properly. I can't figure out why.
In my project i need to calculate the distance between two lattitude and longitude points. After compiling the code I am getting an error that "conflicting types for deg2rad". How to solve this? Seems the code looks ok. but...
I was assigned a project to implement a real time graph to an application which continuously outputs data numerically through the GUI. The application that was created to do this is written in C.
I have to turn those numerical numbers into a graphical display that is periodically updated to appear as real time.
My adviser suggested using NTgraph [URL] ...... I had no clue how to implement this to my code and was finally able to understand that the .OCX needs to be registered as a COM and then imported to the application using visual studios. However, I get an error when I try importing it since it is in C (Visual Studios 8) and not an MFC application.
So my question is if it would be possible to implement the ActiveX control to my application even though it is not an MFC application and how to go about it.
Currently I am working on a program that will find the actual distance between two points on a grid. It also determines the angle of the line segment in degrees. Now, i need it to be able to find any other points on or near the line. It will be running in a loop to find each additional point sequentially until all the points have been plotted. Unfortunately, I am not entirely sure how this is done. So far, I think that I could develop an algorithm that converts the angle into a ratio of vertical movements to horizontal ones.
I want to calculate processing time in milliseconds as most of function I found give me in second. I am new user to C++, the code will be running under linux.
this is my first year programming, and in my class, each week we have to write a program. last week we wrote a program in c that made random value point and made a graph of the random points that continued on forever. this week, we have to use statistical functions to find the sum, mean, max, and min of the graph. below is the code i have so far.
define the time and space complexity of an algorithm and about what can i do when the time and space complexity are given and i should write the code corresponding to the restrictions , which i find very difficult.
I have been trying for several months to create a simple SNTP single Client/Server based on RFC5905. Finally I manage to make it work at least I think it works correctly, but when I tried to test my code against a real NTP server (e.g. 0.se.pool.ntp.org:123) the timestamps that I am receiving need to be recalculated. I have tried several different approaches but no matter for 3 days now but no matter what I tried nothing yet.
The problem that I am having in not so much programming error is more about knowing how the NTP server operates.
How to convert the NTP timestamp to Unix epoch timestamp?
Syntax to execute the Server e.g. ./server 127.0.0.1:5000 and Client e.g. ./client 127.0.0.1:5000
Syntax to execute the Client against a real NTP server e.g. ./client 0.se.pool.ntp.org:123
Im just wondering how would i get a formula to calculate the total size and proportion of how far the media player has been played, in proportion with the size of the sizeable form, i need an int for the:
Width of formLength of movieHow long has been played by user
I have this code so far:
//The current position played! - Within the timer.tick event arg! string splayed = axWindowsMediaPlayer1.Ctlcontrols.currentPosition.ToString().Split('.')[0]; int iplayed = Convert.ToInt32(splayed + 1); //The total time of the movie/audio. string stotal = axWindowsMediaPlayer1.Ctlcontrols.currentItem.duration.ToString().Split('.')[0]; int itotal = Convert.ToInt32(splayed);
[Code] ....
I have the "AxWindowsMediaPlayer" reference installed, but i need to know how it would work...
I'm trying to successfully run a program that calculates your BMI but, although it runs, it is not giving the the correct math. Instead, it gives me the number i've submitted as my weight as an answer. I'm using Visual Studio 2008 and the formula: weight / (height/100)*2
Here is my code
#include <iostream> #include <cmath> using namespace std; int main() { int weight; int height; double BMI;
So my midterm exam for programming is done. My program didn't run. Tried rewriting it once I got home. I am still getting an error that the program could not be run. Also, we weren't allowed to use the internet. So I didn't know how to calculate for the discounted rate.
I am using Microsoft Visual Studio 2010.
Given problem:
ABC Hotel offers 5-10% discounts depending on how much money has the user spent. If item purchase is lesser than 1000php (1USD is 43.19PHP) 5% discount is availed. Greater than 1000php then 10% discount is availed. Total price and discounted price should be displayed.
#include<iostream> using namespace std; main() { float a,b,c,d,e,f,g,h,i,j,total,discounted_price; cout<<"Please input price of first 1st item: ";
I am an IT college student and this is a self-assigned project i have done in an attempt to learn programming in C AND at the same time how time scheduling of an OS works (Both done in order to prepare for upcoming semester exams) using FCFS ,SJF, RR and PS algorithms (planning on adding SRT too sometime soon). (took me 9 hours total work time including validations). What i wanna know is from more seasoned coders if i am on the right track. *cross fingers*
Also is there a way to display the time only instead of the date? How will i change the program to display the time in standard 12 hours, instead of 24 hours?
#include <iostream> #include <time.h> using namespace std; int main() { time_t tim; time(&tim); cout << ctime(&tim); }