I need to translate these java codes to c. Thanks 1. public static void main( St
ID: 3792249 • Letter: I
Question
I need to translate these java codes to c. Thanks
1. public static void main( String args[] )
{
String line;
int word;
Scanner stdin = new Scanner(System.in);
while ( stdin.hasNextLine() )
{
line = stdin.nextLine();
word = stdin.nextInt();
stdin.nextLine(); // get rid of the newline after the int
System.out.println( "Read line: "" + line + "", extracting word [" + word + "]" );
System.out.println( "Word #" + word + " is: " + extractWord( line, word ) );
}
stdin.close();
System.out.println( " End of processing" );
}
Explanation / Answer
void main()
{
char line[100];
int word;
while(gets(line)!=NULL)
{
gets(line);
scanf("%d",&word);
printf("Read line:%s,extracting word[%d]",line,word);
printf("Word #%dis:",word,extractWord(line,word));
}
printf(" End of processing");
}