Click here to Skip to main content
15,884,353 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to extract variables from between html tags? Pin
Jeff Archer3-Oct-09 3:17
Jeff Archer3-Oct-09 3:17 
GeneralRe: How to extract variables from between html tags? Pin
PJ Arends3-Oct-09 7:33
professionalPJ Arends3-Oct-09 7:33 
Questiontimer, slideshow time interval Pin
mohammad shankayi2-Oct-09 8:31
mohammad shankayi2-Oct-09 8:31 
AnswerRe: timer, slideshow time interval Pin
David Crow2-Oct-09 8:38
David Crow2-Oct-09 8:38 
GeneralRe: timer, slideshow time interval Pin
mohammad shankayi2-Oct-09 8:43
mohammad shankayi2-Oct-09 8:43 
GeneralRe: timer, slideshow time interval Pin
David Crow2-Oct-09 8:47
David Crow2-Oct-09 8:47 
GeneralRe: timer, slideshow time interval Pin
Iain Clarke, Warrior Programmer4-Oct-09 2:15
Iain Clarke, Warrior Programmer4-Oct-09 2:15 
QuestionI have problem with classes (friend function) Pin
Mohamed_Khalil2-Oct-09 8:12
Mohamed_Khalil2-Oct-09 8:12 
Hi guys,

I implemented Class Time with private members and public function, any way I used to declare friend function to access those private data members.

The first Time give me the right value but the second gives me 0 Zeroooos Frown | :( I done know why

And the header is follwing over here
#pragma once
#include <iostream>
using namespace std;
class Time
{

private:
	int hour;
	int minute;
	int second;
	
public:

	Time();
	Time(int hour,int minute,int second);
	void setTime();
	int getHour(int h);
	int getMinute(int m);
	int getSecond(int s);
	void printTime();
	friend ostream & operator<<(ostream& , Time);
	friend istream& operator>>(istream&,Time);

	
};



.CPP

Time::Time()
{
	this-> hour = 0;
	this-> minute = 0;
	this-> second = 0;
}

Time::Time(int h,int m, int s)
{
	this-> hour = h;
	this-> second = s;
	this-> minute = m;
}
istream & operator>>(istream &in ,Time t2  )
{
	in>>t2.hour>>t2.minute>>t2.second;
	return in;
}


 ostream& operator<<(ostream &o, Time t2 )
{
	o<<t2.hour<<t2.minute<<t2.second;
	return o;
}


Finally the main
Time t(1,22,22);
   Time t2;
   
   cout<<"The first Time is:\n";
   cout<<t;
   cout<<endl;
    cout<<"Enter the second time\n";

   cin>>t2;
   
   cout<<"2nd time\n";
   cout<<t2;
   cout<<endl;
  

   

   system("pause");
   return 0;

AnswerRe: I have problem with classes (friend function) Pin
David Crow2-Oct-09 8:34
David Crow2-Oct-09 8:34 
AnswerRe: I have problem with classes (friend function) Pin
CPallini2-Oct-09 8:35
mveCPallini2-Oct-09 8:35 
JokeRe: I have problem with classes (friend function) Pin
Mohamed_Khalil2-Oct-09 8:45
Mohamed_Khalil2-Oct-09 8:45 
QuestionIs it trusted that a running exe replaces itself by download new version? Pin
includeh102-Oct-09 6:07
includeh102-Oct-09 6:07 
AnswerRe: Is it trusted that a running exe replaces itself by download new version? Pin
PJ Arends2-Oct-09 9:45
professionalPJ Arends2-Oct-09 9:45 
QuestionRegarding Dictionary Application Pin
Anil Kumar.Arvapalli2-Oct-09 5:14
Anil Kumar.Arvapalli2-Oct-09 5:14 
AnswerRe: Regarding Dictionary Application Pin
Maximilien2-Oct-09 5:52
Maximilien2-Oct-09 5:52 
QuestionRe: Regarding Dictionary Application Pin
David Crow2-Oct-09 8:49
David Crow2-Oct-09 8:49 
AnswerRe: Regarding Dictionary Application Pin
Alan Balkany5-Oct-09 4:25
Alan Balkany5-Oct-09 4:25 
QuestionIs there a sample for using ActiveX without registering it? Pin
transoft2-Oct-09 5:03
transoft2-Oct-09 5:03 
AnswerRe: Is there a sample for using ActiveX without registering it? Pin
includeh102-Oct-09 6:02
includeh102-Oct-09 6:02 
GeneralRe: Is there a sample for using ActiveX without registering it? Pin
Code-o-mat2-Oct-09 6:16
Code-o-mat2-Oct-09 6:16 
GeneralRe: Is there a sample for using ActiveX without registering it? Pin
CPallini2-Oct-09 9:09
mveCPallini2-Oct-09 9:09 
GeneralRe: Is there a sample for using ActiveX without registering it? Pin
PJ Arends2-Oct-09 10:06
professionalPJ Arends2-Oct-09 10:06 
GeneralRe: Is there a sample for using ActiveX without registering it? Pin
Nemanja Trifunovic2-Oct-09 10:25
Nemanja Trifunovic2-Oct-09 10:25 
QuestionHow to count repeating elements in an array ? Pin
Waldemar Ork2-Oct-09 4:44
Waldemar Ork2-Oct-09 4:44 
QuestionRe: How to count repeating elements in an array ? Pin
David Crow2-Oct-09 8:44
David Crow2-Oct-09 8:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.