I can not make the "putchxy" function of conio2.h work

0

Hi. I started the computer science course this year and until then I had never been able to study programming at all, so maybe that's why I'm having such basic errors like this.

My problem now is with the C library, which I have to use to do the final work of my story, which is a game.

The teacher passed some activities to us to learn how to use the conio, but for now the only thing I could do was install it hahaha The first activity outside this was "2) Implement a void function that prints a letter read from the keyboard at the position (x, y) using the Conio functions. "Looking at the functions of, I found that the" putchxy "function does just that, but by putting it in my program and compiling it, I think it is doing absolutely nothing because it should print the read character and does not do that. I used arbitrary values defined within the program for x and y.

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

int main ()
{
    char ch;
    int x = 5, y = 5;

    printf("Digite uma letra no teclado:\n");
    scanf(" %c", &ch);
    void putchxy (int x, int y, char ch);

    return (0);
}

Since this was the last class, I'm still in doubt as to whether I'm doing it right. But looking at past slides in class, reading about the function inside the library itself, looking for similar cases here in the stack overflow, I could not find anything that would indicate an error in my code.

I have tried to write in other ways, tried to create another function myself, tried to invert, put the numbers themselves, but in this way no other compiles properly.

Where did I go wrong?

    
asked by anonymous 29.04.2018 / 23:45

1 answer

0

I was able to find out the answer, I will answer here in case someone else has the same difficulties.

There were two errors:

  • I did not call the function correctly during the main, I had just declared it. I had even tried it in other ways, but by my second mistake they did not work out and made me believe they would be wrong too.

  • The second error was regarding the installation of the library in Code :: Blocks. Although when I installed it I added the address to the linker for some reason (maybe I forgot to hit the "Ok" on the way out) it did not save it and for that reason when I ran the function, it just informed me that it was indefinite.

  • I do not know if I can explain in the best way, but I just wanted to formally leave here the resolution of my problem in case someone else has this problem. Many thanks to all who have really helped and any suggestions or comments, I gladly accept.

    This was my first question on the forum.

    The correct code was:

    #include <stdio.h>
    #include <conio2.h>
    #include <conio.h>
    
    int main ()
    
    {
    char ch;
    int x = 5, y = 5;
    
    printf("Digite uma letra no teclado:\n");
    scanf(" %c", &ch);
    putchxy (x, y, ch);
    
    return (0);
    }
    
    void putchxy (int x, int y, char ch);
    
        
    30.04.2018 / 04:21