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;

Recommended Answers

All 2 Replies

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?

commented: I learned something +1

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.