954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Application to study languages

Hello
I wanna create an application that, inserted words an English and words an another one language will show you this in a random mode.
Also you should be able to insert new words and carry on like this.
I'm not smart enough so I got stuck.
If someone would like to help me giving any advice I will really appreciate.

Thanks in advance

this is my code:

#include <stdio.h>
#include <stdlib.h>
#define T 1
#define F 0

typedef struct elem_s
{
char string[20];
}elem_t;


int main()
{
elem_t database[100][2];
int check = 0; // check it's a flag 1-0, 
// 0 if you wanna carry on
// 1 if you wanna exit
char choice[5];
char phraseENG[20];
char phraseIT[20];
int i, j;
do
{
printf("You wanna start or you wanna insert new words?\n (false if you wanna insert a new one, true otherwise) (T/F): \n");
scanf("%s", choice);
}
while(check);

if (choice == F)
{
printf("Insert a new phrase in Italian: \n");
scanf("%s", phraseIT);
printf("Insert a new phrase in English: \n");
scanf("%s", phraseENG);
}

if (choice == T)
{
srand (time(NULL));
choice = rand()%database[100][2];
for(i=0;i<2 ;i++)
{
for(j=0;j<100 ;j++)
{
printf("%s\n", database[100][2]);
}
}
}
return 0;
tagazin
Newbie Poster
12 posts since Jun 2010
Reputation Points: 9
Solved Threads: 0
 

The first problem I see is that you ask for T/F within a loop that depends on variable "check" which you never update. So your program can't possibly get beyond that point.

After that, it's clear that what you read in, in terms of an ENG or IT phrase, never makes it into the database, and then it seems you're really unclear about rand().

So ... what's your next question?

raptr_dflo
Practically a Master Poster
602 posts since Aug 2010
Reputation Points: 76
Solved Threads: 82
 

The first problem I see is that you ask for T/F within a loop that depends on variable "check" which you never update. So your program can't possibly get beyond that point.

After that, it's clear that what you read in, in terms of an ENG or IT phrase, never makes it into the database, and then it seems you're really unclear about rand().

So ... what's your next question?

Thanks, you are right..my ideas are confused..
I appreciated.

tagazin
Newbie Poster
12 posts since Jun 2010
Reputation Points: 9
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: