我的代码中出现这些错误。我确信这些只是因为某个错误,但我找不到它。请帮我!
2010\projects\firstnamelastname\firstnamelastname\testing.cpp(15): error C2065: 'node' : undeclared identifier
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(15): error C2065: 'linked_list2' : undeclared identifier
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(26): error C2065: 'linked_list2' : undeclared identifier
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(29): error C2065: 'linked_list2' : undeclared identifier
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(29): error C3861: 'createQueue': identifier not found
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(35): error C2065: 'linked_list2' : undeclared identifier
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(38): error C2065: 'linked_list2' : undeclared identifier
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(38): error C3861: 'addFront': identifier not found
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(45): error C2065: 'linked_list2' : undeclared identifier
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(45): error C2065: 'linked_list2' : undeclared identifier
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(45): error C3861: 'dQueue': identifier not found
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(48): error C2065: 'linked_list2' : undeclared identifier
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(48): error C3861: 'destroyList': identifier not found
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(52): error C2065: 'linked_list2' : undeclared identifier
1>c:\users\omer\documents\visual studio 2010\projects\firstnamelastname\firstnamelastname\testing.cpp(52): error C3861: 'printList': identifier not found
以下是三个文件 文件 1 >> testing.cpp
//#include<stdio.h>
#include<stdlib.h>
#include "queue.h"
#include "linklist.h"
#include"stdafx.h"
int main(void)
{
int x,n;
int number;
int i;
node *linked_list2= NULL;
while (1)
{
printf("1.)To create Queue\n2.)To nQueue\n3.)To dQueue\n4.)To Destroy Queue\n5.)To Print The Queue\n6.)Exit Program\nPrint Your Choice: ");
scanf("%d",&n);
switch (n) /*Switch statement for testing of different functions*/
{
case 1:
if(linked_list2 == NULL){
printf("Enter Value Please\n");
scanf("%d",&number);
linked_list2=createQueue(number);
}
else
printf("Queue already created\n.");
break;
case 2:
if(linked_list2 != NULL){
printf("Give a no. to add: ");
scanf("%d",&number);
addFront(linked_list2,number);
}
else
printf("Create Link List First\n.");
break;
case 3:
linked_list2=dQueue(linked_list2);
break;
case 4:
destroyList(linked_list2);
printf("List is Empty!! So Exiting Program! Bye!!\n"); /*Exits program after the list is emptied*/
break;
case 5:
printList(linked_list2);
break;
case 6:
printf("Exiting Program");
return 0;
break;
default:
printf("Wrong Input!!! Please Input Again: "); /*asks to input the choice again if its incorrect*/
scanf("%d",&n);
}
}
return 0;
}
文件 2 >> queue.h
#include"linklist.h"
node * dQueue(node *num) /*Deletes the value of the node from the front*/
{
//num = num->next;
return (num->next);
}
void nQueue (node *head, int num ) /*Adds node to the front of Linked-List*/
{
addFront(head,num);
}
node* createQueue(int val){
return createList(val);
}
文件 3 >> 链接列表.h
struct node{
node * next;
int nodeValue;
};
node* initNode(int number);
node* createList (int value);
void addFront (node *head, int num );
void deleteFront(node*num);
void destroyList(node *list);
int getValue(node *list);
void printList(node *list);
我在linklist.cpp
.