473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Unable to solve compiler errors

Hi can ayone help me with this program, cause i dont know how to solve the compiling errors here. thanks
Expand|Select|Wrap|Line Numbers
  1. # include<stdlib.h>
  2. # include<conio.h>
  3. # include<stdio.h>
  4. # define MAXCADENA 8
  5. # define MAXREN 3
  6. # define MAXCOL 4
  7. int validato(int valor);
  8. void ini_renmatdin (int *ap_mat);
  9. void ini_colmatdin (int *);
  10. void ini_desmatdin (int *);
  11. int ins_ini_linealdin(int **ap_ultimo, int *ap_fin, int valor);
  12. int ins_fin_linealdin(int *ap_mat, int **ap_ultimo, int *ap_fin, int valor);
  13. int eli_ini_linealdin(int *ap_mat, int **ap_ultimo, int *ap_fin);
  14. int eli_fin_linealdin(int *ap_mat, int **ap_ultimo, int *ap_fin);
  15. void desplevec(int *ap_vec, int *ap_ultimo);
  16. void main (void)
  17. {
  18.  clrscr();
  19.  int *ap_cad;
  20.  int *ap_ultimo;
  21.  int *ap_fin;
  22.  int *aux;
  23.  int *ap_aux;
  24.  int valor;
  25.  int exito;
  26.  int otro;
  27.  int s;
  28.  int i;
  29.  ap_cad=(int*)malloc(sizeof(MAXCADENA));
  30.  ap_ultimo=ap_cad-1;
  31.  ap_fin=ap_cad+MAXCADENA-1;
  32.  if(!ap_cad)
  33.  {
  34.     printf("\ ERROR: No hay espacio");
  35.  }
  36.  else
  37.  {
  38.             printf("\n 1.- Inicializar matriz por renglon");
  39.             printf("\n 2.- Inicializar matriz por columna");
  40.             printf("\n 3.- Insertar por el inicio");
  41.             printf("\n 4- Insertar por el final");
  42.             printf("\n 5.- Eliminar por el inicio");
  43.             printf("\n 6.- Eliminar por el final");
  44.             printf("\n Elija una opcion");
  45.             scanf("%d",&s);
  46.             switch(s)
  47.             {
  48.  
  49.                 case 1:
  50.                     ini_renmatdin (ap_mat);
  51.                     printf ("\n Exito si se inicializo");
  52.                     break;
  53.  
  54.  
  55.                 case 2:
  56.                     ini_colmatdin (ap_mat);
  57.                     printf ("\n Exito si se inicializo");
  58.                     break;
  59.  
  60.  
  61.                 case 3:
  62.                     ap_ultimo=ap_cad;
  63.                     ap_fin=    ap_cad+MAXCADENA;
  64.                     ap_aux=ap_ultimo;
  65.                     *ap_ultimo=(*ap_ultimo)+1;
  66.                     do
  67.                     {
  68.                         printf("\n Ingresa un valor: ");
  69.                         scanf("%d", &valor);
  70.                         validato(valor);
  71.                         if(i==1)
  72.                         {
  73.                             exito=ins_ini_linealdin(&ap_ultimo,ap_fin,valor);
  74.                             ini_renmatdin (ap_mat);
  75.                             if(exito==1)
  76.                             {
  77.                                 printf("\n Dato insertado");
  78.                             }
  79.                             else
  80.                             {
  81.                                 if(exito==0)
  82.                                 {
  83.                                     printf("\n Overflow");
  84.                                 }
  85.                                 else
  86.                                 {
  87.                                     printf("\n Error");
  88.                                 }
  89.                             }
  90.                             printf("\n Desas Ingresar Otro dato \n 1)No \n 2)Si");
  91.                             scanf("%d",&otro);
  92.                         }
  93.                         else
  94.                         {
  95.                             printf("\n Valor no valido");
  96.                         }
  97.                     }while(otro==2);
  98.  
  99.                     break;
  100.  
  101.                 case 4:
  102.                     ap_ultimo=ap_cad;
  103.                     ap_fin=    ap_cad+MAXCADENA;
  104.                     do
  105.                     {
  106.                         printf("\n Ingresa un valor: ");
  107.                          scanf("%d", &valor);
  108.                         validato(valor);
  109.                          if(i==1)
  110.                          {
  111.                             exito=ins_fin_linealdin(ap_cad,&ap_ultimo,ap_fin,valor);
  112.                             if(exito==1)
  113.                             {
  114.                                 printf("\n Dato insertado");
  115.                             }
  116.                             else
  117.                             {
  118.                                 if(exito==0)
  119.                                 {
  120.                                     printf("\n Overflow");
  121.                                 }
  122.                             else
  123.                             {
  124.                                 printf("\n Error");
  125.                             }
  126.                         }
  127.  
  128.                            printf("\n Desas Ingresar Otro dato \n 1)No \n 2)Si");
  129.                                 scanf("%d",&otro);
  130.  
  131.                     }while(otro==2);
  132.  
  133.                     break;
  134.  
  135.                 case 5:
  136.                     ap_ultimo=ap_cad;
  137.                     ap_fin=    ap_cad+MAXCADENA;
  138.                     aux=ap_cad;
  139.                     *ap_ultimo=(*ap_ultimo)+1;
  140.                     ap_fin=    ap_cad+MAXCADENA;
  141.                     do
  142.                     {
  143.                         printf("\n Ingresa un valor: ");
  144.                          scanf("%d", &valor);
  145.                         validato(valor);
  146.                          if(i==1)
  147.                          {
  148.                             exito=eli_ini_linealdin(ap_cad,&ap_ultimo,ap_fin);
  149.                             if(exito==1)
  150.                             {
  151.                                 printf("\n Dato insertado");
  152.                             }
  153.                             else
  154.                             {
  155.                                 if(exito==0)
  156.                                 {    
  157.                                     printf("\n Underflow");
  158.                                 }
  159.                                 else
  160.                                 {
  161.                                     printf("\n Error");
  162.                                 }
  163.                             }
  164.                         }
  165.  
  166.                            printf("\n Desas Ingresar Otro dato \n 1)No \n 2)Si");
  167.                                 scanf("%d",&otro);
  168.  
  169.                     }while(otro==2);
  170.                     break;
  171.  
  172.  
  173.  
  174.                 case 6:
  175.  
  176.                     ap_ultimo=ap_cad;
  177.                     ap_fin=    ap_cad+MAXCADENA;
  178.                     do
  179.                     {
  180.                         printf("\n Ingresa un valor: ");
  181.                          scanf("%d", &valor);
  182.                         validato(valor);
  183.                          if(i==1)
  184.                          {
  185.                             exito=eli_fin_linealdin(ap_cad,&ap_ultimo,ap_fin);
  186.                             if(exito==1)
  187.                             {
  188.                                 printf("\n Dato insertado");
  189.                             }
  190.                             else
  191.                             {
  192.                                 if(exito==0)
  193.                                 {    
  194.                                     printf("\n Underflow");
  195.                                 }
  196.                                 else
  197.                                 {
  198.                                     printf("\n Error");
  199.                                 }
  200.                             }
  201.                         }
  202.  
  203.                            printf("\n Desas Ingresar Otro dato \n 1)No \n 2)Si");
  204.                                 scanf("%d",&otro);
  205.  
  206.                     }while(otro==2);
  207.                     break;
  208.  
  209.  
  210.                 default:printf("ERROR intente con los valores indicados en el menu");
  211.             }
  212.  
  213.         getch();
  214.  }
  215. }
  216.  
  217. int validato(int valor)
  218. {
  219.     if((valor<0)||(valor>10))
  220.     {
  221.         i=0;
  222.     }
  223.     else
  224.     {
  225.         i=1;
  226.     }
  227.     return i;
  228. }
  229.  
  230.  
  231.  
  232. void ini_renmatdin (int *ap_mat)
  233. {
  234.  /*Inicializar una matriz por renglon en un arreglo dinamico*/
  235.  int *ap_aux;
  236.  ap_aux=ap_mat;
  237.  while(ap_aux<=(ap_mat+(MAXREN*MAXCOL-1)))
  238.  {
  239.     *ap_aux=0;
  240.     ap_aux=ap_aux+1;
  241.  }
  242.  ini_desmatdin (ap_mat);
  243. }
  244.  
  245.  
  246. void ini_colmatdin (int *ap_mat)
  247. {
  248.  /*Inicializar una matriz por columna en un arreglo dinamico*/
  249.  int *ap_ren;
  250.  int *ap_col;
  251.  ap_col=ap_mat;
  252.  ap_ren=ap_mat;
  253.  while(ap_col<=(ap_mat+(MAXCOL-1)))
  254.  {
  255.     ap_ren=ap_col;
  256.     while(ap_ren<=(ap_mat+(MAXREN+MAXCOL-1)))
  257.     {
  258.         *ap_ren=0;
  259.         ap_ren=ap_ren+MAXCOL;
  260.     }
  261.    ap_col=ap_col+1;
  262.    ini_desmatdin (ap_mat);
  263.  }
  264.  
  265. }
  266.  
  267.  
  268. void ini_desmatdin (int *ap_mat)
  269. {
  270.  /*Desplegar una matriz por columna en un arreglo dinamico*/
  271.  int *ap_aux;
  272.  ap_aux=ap_mat;
  273.  while(ap_aux<=(ap_mat+(MAXREN*MAXCOL-1)))
  274.  {
  275.     printf("\n El contenido es %d en la direccion %u : ",*ap_aux,ap_aux);
  276.     ap_aux=ap_aux+1;
  277.  }
  278.  
  279. }
  280.  
  281.  
  282.  
  283. int ins_ini_linealdin(int **ap_ultimo, int *ap_fin, int valor)
  284. {
  285.  /*Insertar un elemento por el inicio en un arreglo de caracteres dinamico
  286.  Recibe:ap_ultimo, el apuntador al ultimo elemento, apuntador al final del arreglo y el
  287.  dato a insertar.
  288.  Envia: nuevo apuntador al ultimo
  289.  -1=error, 0=overflow, 1=exito*/
  290.  int exito;
  291.  if(ap_fin<=NULL)
  292.  {                       exito=-1;
  293.     printf("error");
  294.  }
  295.  else
  296.     {
  297.     if(*ap_ultimo<=NULL)
  298.         {
  299.         exito=-1;
  300.         printf("error");
  301.         }
  302.     else
  303.         {
  304.         if(*ap_ultimo>=ap_fin)
  305.             {
  306.             exito=0;
  307.             }
  308.         else
  309.             {
  310.             (*ap_ultimo)++;
  311.             **ap_ultimo=valor;
  312.             exito=1;
  313.  
  314.  
  315.             while (ap_aux>=ap_cad)
  316.             {
  317.                 (ap_aux+1)=(ap_aux);
  318.                 (*ap_aux)--;
  319.             }(*ap_aux<(*ap_ultimo-1));
  320.             *ap_aux=valor;
  321.             exito=1;
  322.  
  323.  
  324.         }
  325.     }
  326.  
  327.  
  328.  
  329.  desplevec(ap vec,ultimo);
  330.  return exito;
  331. }
  332.  
  333.  
  334. int ins_fin_linealdin(int *ap_cad, int **ap_ultimo, int *ap_fin, int valor)
  335. {
  336.  /*Insertar un elemento por el final en un arreglo de caracteres dinamico
  337.  Recibe:ap_ultimo, el apuntador al ultimo elemento, apuntador al final del arreglo
  338.  dato a insertar.
  339.  Envia: nuevo apuntador al ultimo
  340.  -1=error, 0=overflow, 1=exito*/
  341.  int exito;
  342.  if(ap_fin<=NULL)
  343.  {                       exito=-1;
  344.     printf("error");
  345.  }
  346.  else
  347.     {
  348.     if(*ap_ultimo<=NULL)
  349.         {
  350.         exito=-1;
  351.         printf("error");
  352.         }
  353.     else
  354.         {
  355.         if(*ap_ultimo>=ap_fin)
  356.             {
  357.             exito=0;
  358.             }
  359.         else
  360.             {
  361.                 (*ap_ultimo)++;
  362.                 **ap_ultimo=valor;
  363.                 exito=1;
  364.             }
  365.         }
  366.     }
  367.  
  368.      desplevec(ap vec,ultimo);
  369.      return exito;
  370. }
  371.  
  372.  
  373.  
  374. int eli_ini_linealdin(int *ap_cad, int **ap_ultimo, int *ap_fin)
  375. {
  376.  /*Eliminar un elemento por el inicio en un arreglo de caracteres dinamico
  377.  Recibe:ap_ultimo, el apuntador al ultimo elemento, apuntador al final del arreglo.
  378.  Envia: nuevo apuntador al ultimo
  379.  -1=error, 0=underflow, 1=exito*/
  380.  int exito;
  381.  if(ap_fin<=NULL)
  382.  {
  383.     exito=-1;
  384.     printf("error");
  385.  }
  386.  else
  387.     {
  388.     if(*ap_ultimo<=NULL)
  389.         {
  390.         exito=-1;
  391.         printf("error");
  392.         }
  393.     else
  394.         {
  395.         if(*ap_ultimo<ap_cad)
  396.             {
  397.             exito=0;
  398.             }
  399.         else
  400.             {
  401.                 do
  402.                 {
  403.                     (ap_cad+aux)=(ap_cad+aux+1);
  404.                     (*aux)++;
  405.                 }while(*aux<(*ap_ultimo-1);
  406.                 exito=1;
  407.             }
  408.         }
  409.     }
  410.  desplevec(ap vec,ultimo);
  411.  return exito;
  412. }
  413.  
  414.  
  415.  
  416.  
  417. int eli_fin_linealdin(int *ap_cad, int **ap_ultimo, int *ap_fin)
  418. {
  419.  /*Eliminar un elemento por el final en un arreglo de caracteres dinamico
  420.  Recibe:ap_ultimo, el apuntador al ultimo elemento, apuntador al final del arreglo.
  421.  Envia: nuevo apuntador al ultimo
  422.  -1=error, 0=underflow, 1=exito*/
  423.  int exito;
  424.  if(ap_fin<=NULL)
  425.  {
  426.     exito=-1;
  427.     printf("error");
  428.  }
  429.  else
  430.     {
  431.     if(*ap_ultimo<=NULL)
  432.         {
  433.         exito=-1;
  434.         printf("error");
  435.         }
  436.     else
  437.         {
  438.         if(*ap_ultimo<ap_cad)
  439.             {
  440.             exito=0;
  441.             }
  442.         else
  443.             {
  444.                 **ap_ultimo=0
  445.                 (*ultimo)--;
  446.                 exito=1;
  447.             }
  448.         }
  449.     }
  450.  desplevec(ap vec,ultimo);
  451.  return exito;
  452. }
  453.  
  454.  
  455.  
  456. void desplevec(int *ap vec, int *ultimo)
  457. {
  458.     while(ap_vec!=ultimo)
  459.     {
  460.         printf("%d",*ap_vec);
  461.         ap_vec++;
  462.     }    
  463. }
Sep 19 '07 #1
3 1987
mac11
256 100+
thats a ton of code - what error do you get?
Sep 19 '07 #2
only 5 but they are kind of "simple" errors and also 2 warnings hope u?'ll help me find out
Sep 19 '07 #3
dfound
52
Where do you get the errors??

What are the error messages shown ??
Sep 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Evangelista Sami | last post by:
hello i have this strange error message that i dont understand : _search.c: In function `_depth_search': _search.c:218: unable to find a register to spill in class `AREG' _search.c:218: this...
102
by: Skybuck Flying | last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C compilers produce so many error messages as soon as a closing bracket is missing. The response was simply because the compiler...
3
by: loser | last post by:
Hi, I made the unfortunate mistake of installing Windows 2000 Service Pack 4 and .NET Framework 1.0 Service Pack 2 on a development machine (1.0.3705.288). This broke the Visual Studio .NET...
0
by: Andrew | last post by:
Hi, I made the unfortunate mistake of installing Windows 2000 Service Pack 4 and .NET Framework 1.0 Service Pack 2 on a development machine (1.0.3705.288). This broke the Visual Studio .NET...
3
by: DJTN | last post by:
I'm getting the following error when I try to compile my setup project in VS 2002. I have re-installed the .net framework 1.1 and it didnt solve the problem. WARNING: Unable to find dependency...
3
by: purkka | last post by:
Hi I replaced a Win 2000 Adv server to the Win 2003 Std with Front Page Server Extension and .Net Framework 2.0. FPSE is extended to Default Web Site. Visual Studio 2005: If I create a new web...
0
by: ufnuceda | last post by:
Hello everyone, I was wondering if any of you have some experience with the boost library. I am having trouble compiling code with it. Since boost is being used a lot these days I thought some...
2
by: Niels | last post by:
Hi, We have an ASP.NET application that uses Server.CreateObject in the .aspx pages to create (ASP) COM-components (we use the 'aspcompat="true"' option). From the beginning we have seen COM+...
3
by: =?Utf-8?B?TGV3aXMgTW90ZW4=?= | last post by:
Hello. We are having a problem here trying to compile C# applications. Only one developer has a problem where they attempt to compile the application and the compiler complains about being out of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.