Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8813155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:46:28+00:00 2026-06-14T03:46:28+00:00

|55|error: no match for ‘operator<<‘ in ‘std::cout << DetermineElapsedTime(((const MyTime*)(& tm)), ((const MyTime*)(& tm2)))’|

  • 0

|55|error: no match for 'operator<<' in 'std::cout << DetermineElapsedTime(((const MyTime*)(& tm)), ((const MyTime*)(& tm2)))'|

I realize that cout does not understand the how to output that correctly. However, at this moment neither do I.

Here is my code. The issue is all the way near the bottom.

#include <iostream>
#include <cstdlib>
#include <cstring>


using namespace std;
struct MyTime { int hours, minutes, seconds; };
MyTime DetermineElapsedTime(const MyTime *t1, const MyTime *t2);

const int hourSeconds = 3600;
const int minSeconds = 60;
const int dayHours = 24;

MyTime DetermineElapsedTime(const MyTime *t1, const MyTime *t2)
{
    long hourDiff = ((t2->hours * hourSeconds) - (t1->hours * hourSeconds));
    int timeHour = hourDiff / hourSeconds;
    long minDiff = ((t2->minutes * minSeconds) - (t1->minutes * minSeconds));
    int timeMin = minDiff / minSeconds;
    int timeSec = (t2->seconds - t1 -> seconds);
    MyTime time;
    time.hours = timeHour;
    time.minutes = timeMin;
    time.seconds = timeSec;
    return time;
}


main(void)
{
    char delim1, delim2;
    MyTime tm, tm2;
    cout << "Input two formats for the time. Separate each with a space. Ex: hr:min:sec\n";
    cin >> tm.hours >> delim1 >> tm.minutes >> delim2 >> tm.seconds;
    cin >> tm2.hours >> delim1 >> tm2.minutes >> delim2 >> tm2.seconds;

    if (tm2.hours <= tm.hours && tm2.minutes <= tm.minutes && tm2.seconds <= tm.seconds)
        {
            tm2.hours += dayHours;
        }
    cout << DetermineElapsedTime(&tm, &tm2); // Problem is here

    return 0;

}

Also, any hints on how I can output the time elapse as 01:01:01 if needed? I know about setfill.. somewhat.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:46:29+00:00Added an answer on June 14, 2026 at 3:46 am

    MyTime is a struct. Overload the << operator for this type

    std::ostream& operator<< (ostream& os, const MyTime& m) {
           os << m.hours << ":" << m.minutes << ":" << m.seconds;
           return os;
    }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Error: ..\Record.cpp: In function `std::ostream& operator<<(std::ostream&, Record&)': ..\Record.cpp:83: error: no match for 'operator<<' in
I'm getting the following error error: no match for 'operator&&' in 'board[0][0] && board[0][1]'
I have following code: inline bool match(const std::wstring & text1, const std::wstring & text2)
Have error ValueError: time data '2012-03-15 9:45:00 AM' does not match format '%Y-%m-%d %H:%M:%S'
In the following I the get the error IndentationError: unindent does not match any
We're getting a server error saying Parameter count does not match Parameter Value count.
Does anyone knows why i receive this error : preg_match() [function.preg-match]: Unknown modifier '('
I am getting error no match for operator==in__first. Here is the code: header file:
I'm reading Effective C++ (Scott Meyers), and getting the error no match for operator*
I'm trying out the code at http://www.scala-lang.org/node/112 and I'm getting a match error for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.