编译C++程序时报错:“unable to start program' e\visual studio 2005 \vc\projects\debug\list.exe”为什么debug文件夹中不能生成list.exe可执行文件呢?
代码如下:
List1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int main(array<System::String ^> ^args)
{
const string a ="the sentinel is";
const float sentinel=-1.00;
const string result1="升序排列是:";
const string result2="降序排列是:";
Bidirectional Iterator <float>list;
cout<<a<<sentinel<<":";
float num;
cin>>num;
while(num!=sentinel)
{
list.push_front(num);
cout<<a<<sentinel<<":";
cin>>num;
}
Bidirectional Iterator<float>::Iterator itr;
cout<<result1<<endl;
for(itr=list.begin();itr!=list.end();itr++)
{
cout<<*itr<<endl;
}
cout<<result2<<endl;
for(itr=list.end();itr!=list.begin();itr--)
{
cout<<*itr<<endl;
}
}
return 0;
}
#pragma once
// TODO: 在此处引用程序需要的其他头文件
//#ifndef Bidirectional Iterator
#define Bidirectional Iterator
template<class T>
class Bidirectional Iterator
{
protected:
struct Node
{
T item;
Node* prey;
Node* next;
} // struct Node
Node* head;
long length;
public:
class Iterator
{
friend class Bidirectional Iterator;
Iterator(Node* newPtr)
{
nodePtr=newPtr;
}
public:
Iterator(){}
Node* nodePtr;
}
Bidirectional Iterator()
{
head=NULL;
length=0;
}
long size() const
{
return length;
}
public:
void push_front (const T& newItem)
{
Node* newHead=new newNode;
newHead -> item=newItem;
newHead -> next=head;
head ->prey=newHead;
length++;
}
public:
void pop_front()
{
Node* oldHead=head;
head=(*head).next;
delete oldhead;
}
// void operator= (const Linked<T>& otherLinked)
Iterator begin()
{
return Iterator(head);
}
Iterator end()
{
return Iterator(NULL);
}
~Linked()
{
while(head!=NULL)
pop_front();
}
Iterator operator++(int)
{
Iterator temp=*this;
nodePtr=(*nadePtr).next
return temp;
}
Iterator operator--(int)
{
Iterator temp=*this;
nodePtr=(*nodePtr).prey;
return temp;
}
// Postcondition: true has been returned if the
// iterator is equal to itr; otherwise,
// false has been returned.
bool operator== (const Iterator& itr) const
{
return nodePtr == itr.nodePtr;
} // overloading ==
// Postcondition: true has been returned if the
// iterator is not equal to itr;
// otherwise, false has been returned.
bool operator!= (const Iterator& itr) const
{
return nodePtr != itr.nodePtr;
} // overloading !=
}; // class Linked