Homework Help

# Hello I need help with the following program in borland c + + 5.02.!the application...

Student

eNotes Newbie

• Up
• 0
• Down

Hello I need help with the following program in borland c + + 5.02.!

the application code.

#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <iostream.h>

class pila
{
int vec[20],frente;
int max;
public:
void push_p(int numero);
int pop_p();
void establece (int fr,int mx);
void listar();
};// fin definicion de la clase
// implementacion de metodos de la clase

void pila::push_p(int numero)
{
if (frente < max)
{
vec[frente]= numero;
frente = frente + 1;
}
else
{
cout <<"no hay espacio";
getch();
}

}

int pila::pop_p()
{ int valor = -1;
if (frente  >= 0)
{valor = vec[frente];
if (frente ==0)
cout <<"ultimo dato";
else
frente = frente -1;
}                                           `

else
{ cout <<"no hay mas datos";
getch();
frente = 0;

}
return valor;
}

void pila:: establece(int fr, int mx)
{
frente = fr;
max=mx;

}

void pila ::listar()
{
for (int i = 0; i<frente; i++)
cout <<"pila ["<<1<<"];"<<vec[i]<<";
}

errors

Info :Compiling C:\BC5\BIN\noname00.cpp
Error:  noname00.cpp(41,2):Illegal character '`' (0x60)
Error:  noname00.cpp(62,23):Unterminated string or character constant
Error:  noname00.cpp(63,2):Statement missing ;
Error:  noname00.cpp(63,1):Compound statement missing }

Posted by lance3 on February 17, 2012 at 6:31 AM via web and tagged with borland, c++, computer science, programation

High School Teacher

(Level 2) Educator

• Up
• 1
• Down

Although it is difficult to determine where the first error is coming from since you do not include your line numbers, the error on line 41 is that you have put an accent grave in your code instead of a single quotation mark.  C++ only accepts quotation marks (either single or double) and accents (either grave or acute) will cause errors.

On the last line inside your final for loop, you have an extra <<" which is causing the remaining errors.  If you remove those three characters your remaining errors should go away.

Posted by lfryerda on July 21, 2012 at 3:19 PM (Answer #1)

See all »