473,495 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

I have four errora that I cant find nor can I fix so I kinda need help with this prog

1 New Member
Expand|Select|Wrap|Line Numbers
  1. #include"stdafx.h"
  2. #include <iomanip>
  3. #include <iostream>
  4. #include <math.h>
  5.  
  6. using std::cout;
  7. using std::cin;
  8. using std::endl;
  9. using std::fixed;
  10.  
  11. int main()
  12. {Pi = 3.1415926;
  13.     double d;
  14.     double degreeAngle;
  15.     double D;
  16.     double degreeAngle2;
  17.     double Xm;
  18.     double Ym;
  19.     double Xt;
  20.     double Yt;
  21.     double g;
  22.  
  23.  
  24.     cout<<"Enter Angle in degree"<<endl;
  25.     cin>>degreeAngle;
  26.  
  27.     while(degreeAngle<=0 && degreeAngle>=90) cout<<"Enter a value between 0 and 90";
  28.     else    cout<<"Enter value of d";
  29.                 cin>>d;
  30.                 while(d<=0) cout<<"Enter positive vale for d",
  31.                 else 
  32.                 {
  33.                     D=tan((90- degreeAngle)*3.141592/180)
  34.                         if(D>3500) cout<<"Target out of Range",
  35.                         else 
  36.                         {cout<<"Target is in Range";
  37.                     cout<<"Enter value of Alfa 2 in degree";
  38.                     cin>>degreeAngle2;
  39.                     {if(degreeAngle2>90) degreeAngle2=degreeAngle2%90;
  40.                     else if(degreeAngle2<=0) cout<<"Enter a positive value of Alfa 2";
  41.  
  42.                         cout<<"Enter your actual coordinates";
  43.                         {
  44.                             cin>>Xm;
  45.                             cin>>Ym;
  46.                             Xt=Xm+(D*cos(degreeAngle));
  47.                             Yt=Ym+(D*sin(DegreeAngle));
  48.                             cout<<"Your Target's current position is x="<<Xt<<"y="<<Yt<<endl
  49.                                 cout<<"Enter the value of g (the gravitation)";
  50.                             cin>>g
  51.  
  52.                                 degreeAlfa2=arcsin((g*D)/2*820*820)
  53.  
  54.                         };
  55. };
  56.  
  57. };
  58.                     };
  59. }
  60.  
  61.                         return 0;
  62.  
Here is my code. Here's what I have to do in this program. Im in a tank (AA88) I cant move from the tank nor can it move. I need to find my targets coordinates. I used Pythagore to find the distance from myself to the target. Then to find its coordinates I used Rayon (rayon=distance) Xt which is X of the target, Xt=Rcos (alfa) (alfa determined and inputed by user sooner) and for Yt=Rsin (alfa). Then I have to find the angle for firing, which I used to find a long physical properties about projectiles. My problem is that with this code I seem to have 4 errors that I dont ubderstand how to fix
Oct 26 '13 #1
1 1163
weaknessforcats
9,208 Recognized Expert Moderator Expert
This code:

Expand|Select|Wrap|Line Numbers
  1. Pi = 3.1415926;
needs a type for Pi. Probably this:

Expand|Select|Wrap|Line Numbers
  1. double Pi = 3.1415926;
The rest of your errors are in a deeply nested if-else where no attention was paid to the structure of an if-else.

The correct way to write these is:

Expand|Select|Wrap|Line Numbers
  1. if ( some test)
  2. {
  3.      //test is true
  4. }
  5. else
  6. {
  7.     // test is false
  8. }
Unless you use the braces exactly as shown you will get odd results.

Expand|Select|Wrap|Line Numbers
  1. if ( some test)
  2.  
  3.      a = 5;       <- the semicolon terminates the if
  4.  
  5. else              <- this is now missing an if
  6. {
  7.     // test is false
  8. }
Oct 27 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1885
by: Daniel Bello Urizarri | last post by:
Hello: I have a web service that runs well on ASP 1.0. Now I'm migrating it to ASP 2.0, and now im at the point in wich the project runs under the ASP Developer server od the visual studio 2005,...
2
1186
by: yasin | last post by:
I have to refresh my site every 5 secs but I cant find my sites meta tag in my site I think there is no meta tag clearly pages includes masterpages. How can I access the meta tag of my page whit...
1
1867
by: Eric | last post by:
This program is running fine in my office i just copy it and run at home it start given that error and highlight Chr(13). I dont know is this is what the error is or some thing else Compiler...
2
1340
by: cv87cv | last post by:
I am trying to answer a question with regards to entering a set of numbers and text, and then I have got to search for a number and the text with it. I wish to enter the name on one line and the...
1
1902
by: niraj | last post by:
I am getting the following error /usr/bin/ld: cant find -lutl Please advice which module i need to install .I am unable to find it . TIA Niraj
2
2057
by: andrewanderson | last post by:
hi can anyone help me with this prog. cant find the prob why it cant display cout<<"This is the display of your transaction"<<endl; ifstream fobj; //declare input file stream ...
1
1906
by: foocc | last post by:
Hi, im trying to convert data reports (.dsr) in vb6 to crystal reports in vb.net. However, I cant seems to find it in my Microsoft Visual Studio 2005 Tools for Office. I've tried going to...
4
1866
by: gawasthi | last post by:
Hi, I am absolutely new to perl and for a specific reqmt I am running the following script: #!/usr/bin/perl use warnings; use lib '/opt/InCharge65/IP/smarts/perl/5.6.1/lib'; use...
1
1400
by: figaro | last post by:
Hi All, I have developed an application in .net, now the thing is I have to display the data on a report. I thought of using a crystal report. Here I understand that I have to add Crystal...
2
2671
by: nevila | last post by:
i know my pass but i am a user and i cant find the ip of the camera at work?please help me?because i know the password. Best regard, Nevila
0
7160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7373
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4583
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1405
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.