Jump to content

TennisPrez12

New Members
  • Posts

    1
  • Joined

  • Last visited

Profile Information

  • Favorite Area of Science
    Computer Science

TennisPrez12's Achievements

Lepton

Lepton (1/13)

0

Reputation

  1. Hi guys, I'm writing a simple program which takes similar values from a user at the keyboard. But I've run into some issues and I'm not sure why. It MUST be to do with the conversion specifiers but I just can't figure it out :/ Here's the code: /* * File: main.c * Author: daniel * * Created on March 27, 2012, 6:49 PM */ #include <stdio.h> #include <stdlib.h> #include "main.h" #define MAX_LAT 52.75 #define MIN_LAT 51.5 #define MAX_LNG 6.5 #define MIN_LNG 4.75 #define REQ_LAT 0.1 #define REQ_LNG 0.2 /* * This function takes a location value from the user and if any ships are * within 0.1 latitude or 0.2 longitude of this position the function will produce * a message and log the information appropriately */ int main(int argc, char** argv) { ship s; // struct in the headerfile containing latitude and longitude of type double double user_lat; double user_lng; // THESE TOP TWO PRINTFS WILL BE REPLACED BY VALUES TAKEN FROM OUR // DATA ENTRY PROGRAM printf("Please enter a specific latitude value for the vessel: "); scanf("%lf", s.latitude); printf("%lf", s.latitude); //used for de-bugging printf("Please enter a specific longitude value for the vessel: "); scanf("%lf", s.longitude); printf("Now enter a latitude area you'd like to check in: "); scanf("%le", &user_lat); printf("Now enter a corresponding longitude area you'd like to check in: "); scanf("%le", &user_lng); //IF LATITUDE/LONGITUDE VALUES OF THE SHIP ARE WITHIN //USER'S GIVEN VALUES IN ACCORDANCE WITH THE REQUIRED LAT AND LNG //PRODUCE A MESSAGE // THIS LOOP WILL DEAL WITH WHETHER A SHIP IS WITHIN THE BOUNDARIES OF // A USER'S CHOSEN LAT AND LNG VALUES AND ALSO DEAL WITH WHETHER OR NOT SHIP'S // ARE EVEN IN St.George's CHANNEL AT ALL! return (EXIT_SUCCESS); } Now the program runs and lets me enter the latitude and longitude figures but then produces the RUN FAILED error message. For reference here's the output: Please enter a specific latitude value for the vessel: 51.425 0.000000Please enter a specific longitude value for the vessel: 51.233 RUN FAILED (exit value 1, total time: 10s) Anyone got any ideas? To me it should just at the moment take four values from the user :/ Thanks guys, TP12
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.