CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2009
    Posts
    3

    This is my first programming project, and I really need some help

    Okay. I'm new to programming and I'm currently taking online C++ programming classes.

    I'm doing this project involving hurricanes. I compiled this program into the C++ Compiler

    This is the program I placed in there.

    -----
    ---
    //Project 1

    #include <stdhx>
    #include <iostream>
    using namespace std;
    int main()

    {
    double lat1; lat2; long1; long2; leg1; leg2;
    cout <<"Enter value for Latitude"<<;
    cin >> lat1;
    cout <<"Enter second value for latitude<<;
    cin >> lat2;
    cout << "Enter Value for Longitude";
    cin >> long1;
    cout << "Enter 2nd value for longitude";
    cin >> long2;
    leg1 = = lat2-lat1;
    leg2 = = long2 - long1;
    cout << "First leg =" <<leg1<<endl;
    cout << Second leg =" <<leg2 <<endl;

    return 0;

    }
    -------------

    Here I found 20 errors I couldn't really read. If you want to see them , please let me know.

    Thank you so much for your help.

    ~Rukiya

  2. #2
    Join Date
    Jul 2002
    Location
    Seattle Area, WA
    Posts
    241

    Re: This is my first programming project, and I really need some help

    Is this in Microsoft Visual Studio? If so, what type of project did you select to start with?

  3. #3
    Join Date
    Jun 2009
    Posts
    3

    Re: This is my first programming project, and I really need some help

    Quote Originally Posted by KingTermite View Post
    Is this in Microsoft Visual Studio? If so, what type of project did you select to start with?
    This is in Microsoft studio.
    And I think I used WIN32 Console project.

  4. #4
    Join Date
    Jun 2005
    Posts
    315

    Re: This is my first programming project, and I really need some help

    Try changing this,
    Code:
    double lat1; lat2; long1; long2; leg1; leg2;
    to this
    Code:
    double lat1, lat2, long1, long2, leg1, leg2;
    and also this
    Code:
    leg1 = = lat2-lat1;
    probably doesn't do what you think it does.
    Last edited by jeron; June 10th, 2009 at 02:04 PM.

  5. #5
    Join Date
    Jun 2009
    Posts
    3

    Re: This is my first programming project, and I really need some help

    Quote Originally Posted by jeron View Post
    Try changing this,

    Code:
    leg1 = = lat2-lat1;
    probably doesn't do what you think it does.
    That leg1 is supposed to be a variable.

    So I can't write x == a +b?

  6. #6
    Join Date
    Jul 2002
    Location
    Seattle Area, WA
    Posts
    241

    Re: This is my first programming project, and I really need some help

    Quote Originally Posted by Rukiya View Post
    That leg1 is supposed to be a variable.

    So I can't write x == a +b?
    == means evaluation like if (a == b)
    = means assign like a = c+2

    So using double equal there means you are testing logic, not assigning a value. It appears to be that you mean to assign a value because testing logic without any type of conditional statement (if, while, for, etc...) would not make sense.c

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured