Click here to Skip to main content
15,887,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: error while using fild name as timestamp Pin
Richard MacCutchan28-Nov-09 1:41
mveRichard MacCutchan28-Nov-09 1:41 
QuestionRe: error while using fild name as timestamp Pin
David Crow29-Nov-09 16:28
David Crow29-Nov-09 16:28 
QuestionNeed a Similar API AudioVideoPlayback in unmanage code Pin
Shivanand Gupta27-Nov-09 19:00
Shivanand Gupta27-Nov-09 19:00 
AnswerRe: Need a Similar API AudioVideoPlayback in unmanage code Pin
Richard MacCutchan27-Nov-09 21:47
mveRichard MacCutchan27-Nov-09 21:47 
QuestionPlay Two video file in different left right speaker Pin
Shivanand Gupta27-Nov-09 18:54
Shivanand Gupta27-Nov-09 18:54 
AnswerRe: Play Two video file in different left right speaker Pin
Richard MacCutchan27-Nov-09 21:45
mveRichard MacCutchan27-Nov-09 21:45 
AnswerRe: Play Two video file in different left right speaker Pin
Rozis28-Nov-09 4:22
Rozis28-Nov-09 4:22 
QuestionConverting different data types from a class template. Pin
Member 382253227-Nov-09 15:10
Member 382253227-Nov-09 15:10 
I'm wondering if there is a simple/efficient process to which i can convert from a template class to any other primitive/abstract data type.


I'll give the coding snippets that pertains to the problem I'm having..


DRIVER PROGRAM--just show what it does globally...

<br />
int main()<br />
{<br />
<br />
char cCatchVar;<br />
float fCatchVar;<br />
int iCatchVar;<br />
sExample sCatchVar;<br />
<br />
<br />
<br />
<br />
Stack<char> ocStack1(4);<br />
Stack<int> oiStack1(4);<br />
Stack<int> oiStack2(4);<br />
Stack<float> ofStack1(4);<br />
Stack<float> ofStack2(4);<br />
Stack<sExample> osStack1(4);<br />
<br />
<br />
<br />
<br />
cout << "\n pushing value ')' in template class char...";<br />
ocStack1.push(')');<br />
<br />
<br />
cout << "\n pushing value 2 in template class int...";<br />
oiStack1.push(2);<br />
<br />
cout << "\n pushing value 12 in second template class int \n (to demostrate the != operator)... \n \n";<br />
oiStack2.push(12);<br />
<br />

and so on for the pushing and popping of the stack...





I need to be able to enforce balanced parenthesis format for whatever data types happen to be in the stack.
The way i figure is that there must be someway to be able to to recognize what data type is being used with the class template at runtime, distinguish it, and continue with the checking of the balanced parenthesis.



this is how the push function of the stack uses my incomplete balanced parenthesis class function..


<br />
template <class T><br />
void Stack<T> ::push(T c)<br />
{<br />
	<br />
bool bError=false;<br />
<br />
//bError = checkParen();// THIS IS THE FUNCTION<br />
	<br />
//if(bError)<br />
//{<br />
	//cout<<endl<<"ERROR--input needs balanced parenthesis \n ;<br />
//}<br />
<br />
 if (isFull())<br />
{<br />
	cout << "The stack is full. \n";<br />
}<br />
else<br />
{<br />
	iTop++;<br />
	cStackArray[iTop] = c;<br />
<br />
}<br />
}<br />
<br />
<br />



this is the actual coding of my attempt for the function.....
<br />
<br />
template <class T><br />
bool Stack<T> ::checkParen()<br />
{<br />
<br />
T cCatchPop;<br />
bool bStatus1 = false;<br />
bool bStatus2 = false;<br />
bool bStatus3 = false;<br />
char cLeftPar = '(';<br />
<br />
<br />
//char cRightPar = ')';<br />
<br />
Stack::iCharsInStack++;<br />
Stack::pop(cCatchPop);<br />
<br />
Stack::push(cCatchPop);<br />
if(iCharsInStack==1)<br />
{ <br />
bStatus1 = false;<br />
}<br />
else<br />
{<br />
bStatus1 = true;<br />
}<br />
if(bStatus1 == true || bStatus2 == true)<br />
{<br />
bStatus3=true;<br />
}<br />
<br />
return bStatus3;<br />
<br />
<br />

the coding above for the checkparen function is incomplete and has been deleted through, revised, completely deleted,changed around about 4 times and probably doesn't represent my best attempt at the problem. I just thought posting the code might be helpful to explain my problem anyway.
Basically i tried everything I thought would work. So any advice would be helpful.

Thank you in advance!!

AnswerRe: Converting different data types from a class template. Pin
«_Superman_»27-Nov-09 17:19
professional«_Superman_»27-Nov-09 17:19 
QuestionOpen-With menu items for given file extension Pin
michalJ27-Nov-09 13:25
michalJ27-Nov-09 13:25 
AnswerRe: Open-With menu items for given file extension Pin
Rozis28-Nov-09 4:25
Rozis28-Nov-09 4:25 
QuestionUploading a file using CHttpFile Pin
msn9227-Nov-09 12:17
msn9227-Nov-09 12:17 
QuestionThread handle from thread ID [solved] Pin
PJ Arends27-Nov-09 10:40
professionalPJ Arends27-Nov-09 10:40 
AnswerRe: Thread handle from thread ID Pin
Garth J Lancaster27-Nov-09 11:28
professionalGarth J Lancaster27-Nov-09 11:28 
GeneralRe: Thread handle from thread ID Pin
PJ Arends27-Nov-09 17:01
professionalPJ Arends27-Nov-09 17:01 
Questionplease help : how to draw BSpline by using mouse ??? Pin
a04.lqd27-Nov-09 6:59
a04.lqd27-Nov-09 6:59 
AnswerRe: please help : how to draw BSpline by using mouse ??? Pin
Richard MacCutchan27-Nov-09 7:14
mveRichard MacCutchan27-Nov-09 7:14 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
a04.lqd27-Nov-09 7:19
a04.lqd27-Nov-09 7:19 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
Richard MacCutchan27-Nov-09 7:27
mveRichard MacCutchan27-Nov-09 7:27 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
Cedric Moonen27-Nov-09 7:28
Cedric Moonen27-Nov-09 7:28 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
CPallini27-Nov-09 7:26
mveCPallini27-Nov-09 7:26 
GeneralRe: please help : how to draw BSpline by using mouse ??? Pin
Richard MacCutchan27-Nov-09 7:28
mveRichard MacCutchan27-Nov-09 7:28 
AnswerRe: please help : how to draw BSpline by using mouse ??? Pin
«_Superman_»27-Nov-09 9:15
professional«_Superman_»27-Nov-09 9:15 
QuestionQuestion about double #INF and #NAN Pin
Jeff Archer27-Nov-09 5:02
Jeff Archer27-Nov-09 5:02 
QuestionRe: Question about double #INF and #NAN Pin
CPallini27-Nov-09 5:54
mveCPallini27-Nov-09 5:54 

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.