Hi all, I'm new to c.
This is my first project, a talking bot named Kaat.
There are some stuff I don't know how to do. In order to make the program complete, I put the code here to get some help.
My main problem is the talk function, it will ouput sentences from time to time (because c is so fast, but I don't know how to do that....) and also track the keyboard for a key pressed event.
This is what I call the skeleton:
HTML Code:
/*
KaaT - (Kaa talking program)
Version: 0.0
By Victor NOAGBODJI
2005-05-13
Notes:
- This talking program will focus on the way of talking and answering
Todo:
- complete the program
- add talking attitude (polite, rude, cool ....)
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#define MAXLINE 1000 /* maximum input line size */
/* Prototypes */
void talk (char *sentence_pointer);
char *getline(char *line, int maxline);
/* Globals */
/* About sentences*/
char about[3];
about[0][] = "My name is KaaT, version 0.0";
about[1][] = "Victor is my creator.";
about[2][] = "I don't know my age yet.";
/* Special sentences, that conduct the program */
char specials[6];
specials[0][] = "So, I was saying that";
specials[1][] = "Are you going to say something?";
specials[2][] = "Can I finish please?";
specials[3][] = "I was going to say that";
specials[4][] = "I've forgotten what I was saying.";
specials[5][] = "Maybe I talk too much";
/* Some subjects sentences */
int main(void)
{
/* variables */
int rc = EXIT_SUCCESS;
/* do stuff */
/* is everything fine? */
if(!) {
rc = EXIT_FAILURE;
}
return rc;
}
/* getline: read a line into s, return s (from C_dreamer)*/
char *getline(char *line, int maxline)
{
int c, i, j;
for(i = 0, j = 0; (c = getchar())!=EOF && c != '\n' && c != '.'; ++i)
{
if(i < lim - 1)
{
*line++ = c;
}
}
if(c == '\n')
{
if(i <= lim - 1)
{
*line++ = c;
}
++i;
}
line[j] = '\0';
return *line;
}
/* output sentences time from time while the user is not entering anything*/
void talk (char *sentence_pointer)
{
/* variables */
/* talking loop */
/* get the next sentence */
/* output the next sentence if the user is not writing something*/
}
Thanks you all for help in advance.