Homework Help

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

user profile pic

lance3 | Student, Undergraduate | eNotes Newbie

Posted February 17, 2012 at 6:31 AM via web

dislike 0 like

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 }

1 Answer | Add Yours

user profile pic

lfryerda | High School Teacher | (Level 2) Educator

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

dislike 1 like

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.

Join to answer this question

Join a community of thousands of dedicated teachers and students.

Join eNotes