Created
May 7, 2012 00:44
-
-
Save anonymous/2625190 to your computer and use it in GitHub Desktop.
c program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 | |
Articles 5 | |
the a one some any | |
Nouns 5 | |
boy girl dog town car | |
Verbs 5 | |
drove jumped ran walked skipped | |
Preposition 5 | |
to from over under on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
//Declaring variables.. | |
int numOfSentences; | |
int numOfWords; | |
char word[1]; //temp variable to read in stuff from the file and check it. | |
char* articles[10]; | |
char* artptr = articles; | |
/*char nouns[]; | |
char verbs[]; | |
char prepositions[]; | |
char sentences[]; | |
*/ | |
int main() | |
{ | |
scanf("%d", numOfSentences);//read in the numOfSentences | |
//this is a test | |
scanf("%s", word); | |
scanf("%d", numOfWords); | |
for(int x=0; x < numOfWords; x++) | |
{ | |
artptr = malloc(sizeof(char)*75); | |
scanf("%s", artptr);//articles[x]); | |
articles[x] = artptr; | |
printf("%s\n",artptr); | |
} | |
/* while(scanf("%s",word) != EOF) | |
{ | |
if(word == "Articles") | |
{ | |
scanf("%s", articles); | |
} | |
else if(word == "Nouns") | |
{ | |
scanf("%s", nouns); | |
} | |
else if(word == "Verbs") | |
{ | |
scanf("%s", verbs); | |
} | |
else if(word == "Prepositions") | |
{ | |
scanf("%s", prepositions); | |
} | |
}//end while loop | |
*/ | |
//print out the contents of the arrays to see if it went in correctly. | |
// printf(articles,"\n", nouns, "\n" , verbs, "\n", prepositions); | |
printf("\n%d\n\n%s\n\n%d\n\n\n", numOfSentences, word, numOfWords);//, articles); | |
for(int i =0; i < numOfWords -1; i++) | |
{ | |
printf("%s ", articles[i]); | |
} | |
return(0); | |
}//end main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment