Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error!!

Status
Not open for further replies.

surfing101

Programmer
Joined
Oct 6, 2003
Messages
5
Location
US
I previously posted this, but it got erased. I am currently getting 1 error and I can't find it anywhere?

Code:
//This program will implement the postfix evaluation.  The program will read in a postfix string consisting of only multidigit numeric data and the +,-,*, and /operators.  This program will call and print the result of evaluation algorithm.


//project2.cpp
//GregThimmes
#include <iostream.h>
#include <stdlib.h>
#include &quot;stackADT&quot; 

int main ()
{
	char line [100]
	char * c_ptr;

	int count=0;
	
	cout << &quot; Enter an expression and a multidigit number such as +,0,*,/ operators:  &quot;<<endl;
	cin.getline(line,100);
	for (c_ptr=line; *p_ptr=='   '; ++c_ptr);

	while (*c_ptr != '\0')
	{
		++count;
		for (;  (*c_ptr!= '   ') &&  (c_ptr !='0');
		for (;(*c_ptr=='   '); ++c_ptr);
	}

	cout << &quot;This expresion has &quot; <<count<< &quot;values&quot;;
	cout << endl;

	int expresize = count;

	Stack <char> intstack;

	int index=0;
	char value, operand1,operand2;

	while (index < expresize)
	{
		if ((line[index] != '+') || ((line[index] != '-') || ((line[index] != '*') || ((line[index] != '/')((line[index] != '   '))
			intstack.pushStack ( line [index]);

		else
		{
			operand1 = intstack.popStack (line[index-1]);
			operand2 = intstack.popStack (line[index-2]);

			if (line[index]=='+')
				value = operand1 + operand2;
			else if (line[index]=='-')
				value = operand1 - operand2;
			else if (line[index]=='*')
				value = operand1 * operand2;
			else if (line[index]=='/')
				value = operand1 / operand2;

			intstack.popStack (value);
		}
		index++;
	}
	intstack.popStack (value);
	cout << &quot; The answer is &quot; << value <<endl;
	return 0;
}

This is my error:fatal error C1083: Cannot open include file: 'stackADT': No such file or directory[/b]
 
>I previously posted this, but it got erased.

Probably for a reason. This is not a forum for aid in school projects.

/Per

if (typos) cout << &quot;My fingers are faster than my brain. Sorry for the typos.&quot;;
 
its not as if Im askings someone to do it, just a little help. Nobody is perfect at this stuff. CHILL OUT!
 
Once that error is fixed you will have more errors with p_ptr BUT the error you have is due to VC++ not knowing where to look for the include file.

In your project->settings for the application, select the C++ tab.

In the drop down list select preprocessor

Add the path to your header file to the &quot;Additional Include Directories&quot;

It will then find the file you need to include

Matt
 
Im not finding it. Do I have to create a header?
 
i went to settings and there was no drop down for preprocessor. There was a box for it though with
WIN32,_DEBUG,_CONSOLE,_MBCS, and i added the &quot;Additional Include Directories&quot; to it and i got no erros but it says Cannot execute program?
 
alright i have figured it out, but what should my header file look like??
 
The name of the file (stackADT) suggests it is the definitions required to use some stack Abstract Data Type implemented by your professor, teacher or TA. It should be included in the assignment, or perhaps it is the point of your assignment to design a stack ADT yourself? Ask you prof/teacher/TA, they know a lot more than us about your assignment!

Vincent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top