Thread: A beginner question about classes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    1

    Exclamation A beginner question about classes

    Code:
    #include <string>
    #include <vector>
    #include <iostream>
    using namespace std;
    
    
    class TimeDifference
    {
      public:
        int x,y,z,seconds(string time1, string time2)
    
    
    {
            cin >> time1 >> time2;
            x=(time1[0]*10+time1[1])-(time2[0]*10+time2[1]);
             y=(time1[3]*10+time1[4])-(time2[3]*10+time2[4]);
            z=(time1[6]*10+time1[7])-(time2[6]*10+time2[7]);
    return x*3600+y*60+z;
      }
    };
    This is my code. Basically you need to input time in format 11:45:30 and 11:45:45 for example. It should calculate the seconds difference between the two times. I get an error saying "undefined reference to WinMain@16". Please help ASAP. Thanks in advance
    Last edited by Andrej Simeski; 03-18-2012 at 05:30 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner C Question Help
    By pmacdonald in forum C Programming
    Replies: 32
    Last Post: 06-22-2011, 09:32 PM
  2. Beginner C Question Help
    By Susan M in forum C Programming
    Replies: 2
    Last Post: 06-22-2011, 07:44 PM
  3. beginner question
    By ShaiAdar in forum C Programming
    Replies: 7
    Last Post: 03-24-2009, 04:55 AM
  4. Beginner question - please help
    By mo34 in forum C++ Programming
    Replies: 2
    Last Post: 09-11-2008, 02:34 PM
  5. Beginner Classes Question
    By kbro3 in forum C++ Programming
    Replies: 9
    Last Post: 08-14-2008, 07:43 AM