Привет всем, вот мой код
я попытался показать свои результаты без удачи
я получаю ошибку
count was not declared in this scope
int main()
{
CircularList<int> channelList(0);
cout << "Value Stored: " << channelList.GetValue() << endl; <--- OVER HERE
}
Могут ли некоторые помочь мне показать мои результаты или предоставить решение?
очень благодарен
вот и остальная часть моей программы
/*
* CircularList.h
* *
* Created by on 30/08/11.
* Copyright 2011 ____. All rights reserved.
*
*/
#ifndef _CIRCULARLIST_CPP_
#define _CIRCULARLIST_CPP_
#include<iostream>
#include<string>
#include<cctype>
#include "CircularList.h"
template<class T> CircularList<T>::CircularList(T emptyValue) {
m_EmptyValue = emptyValue;
m_CurrentNode = NULL;
}
template<class T> void CircularList<T>::InsertBefore(T data) {
if(m_CurrentNode == NULL) {
m_CurrentNode = new ListNode<T>();
m_CurrentNode->value = data;
m_CurrentNode->next = m_CurrentNode;
m_CurrentNode->previous = m_CurrentNode;
return;
}
ListNode<T>* tempNode = new ListNode<T>();
tempNode->next = m_CurrentNode;
tempNode->previous = m_CurrentNode->previous;
m_CurrentNode->previous->next = tempNode;
tempNode->value = data;
m_CurrentNode->previous = tempNode;
m_CurrentNode = tempNode;
}
template<class T> void CircularList<T>::InsertAfter(T data) {
if(m_CurrentNode == NULL) {
m_CurrentNode = new ListNode<T>();
m_CurrentNode->value = data;
m_CurrentNode->next = m_CurrentNode;
m_CurrentNode->previous = m_CurrentNode;
return;
}
ListNode<T>* tempNode = new ListNode<T>();
tempNode->previous = m_CurrentNode;
tempNode->next = m_CurrentNode->next;
m_CurrentNode->next->previous = tempNode;
tempNode->value = data;
m_CurrentNode->next = tempNode;
m_CurrentNode = tempNode;
}
template<class T> T CircularList<T>::GetValue() {
if(m_CurrentNode == NULL) return m_EmptyValue;
return m_CurrentNode->value;
}
template<class T> T CircularList<T>::NextValue() {
if(m_CurrentNode == NULL) return m_EmptyValue;
m_CurrentNode = m_CurrentNode->next;
return m_CurrentNode->value;
}
template<class T> T CircularList<T>::PreviousValue() {
if(m_CurrentNode == NULL) return m_EmptyValue;
m_CurrentNode = m_CurrentNode->previous;
return m_CurrentNode->value;
}
template<class T> CircularList<T>::~CircularList() {
while(m_CurrentNode->next != m_CurrentNode && m_CurrentNode->previous != m_CurrentNode) {
ListNode<T>* prevNode = m_CurrentNode->previous;
ListNode<T>* nextNode = m_CurrentNode->next;
prevNode->next = nextNode;
nextNode->previous = prevNode;
delete m_CurrentNode;
m_CurrentNode = nextNode;
}
delete m_CurrentNode;
m_CurrentNode = NULL;
}
int main()
{
CircularList<int> channelList(0);
cout << "Value Stored: " << channelList.GetValue() << endl;
}
#endif