Name: Anonymous 2010-06-17 15:14
Lets see if /prog/ can count to 10 in C. I'll start:
int main(void){
int main(void){
#include <stdio.h> // all the libraries
#include <stdlib.h>
#include <ctype.h>
int main(void) //this is main, its the second most important function in this program
{
FILE *ofp; //input and output files
int i, k = 0;
printf("Enter how many data entries you wish to generate:");
scanf("%d", &k);
char adj1[10][25];
char adj2[10][25];
char adj3[10][25];
char city[10][25];
strcpy(adj1[0], "Super");
strcpy(adj1[1], "Dreadful");
strcpy(adj1[2], "Frozen");
strcpy(adj1[3], "Scortching");
strcpy(adj1[4], "Epic");
strcpy(adj1[5], "Mini");
strcpy(adj1[6], "Cozy");
strcpy(adj1[7], "Confusing");
strcpy(adj1[8], "The");
strcpy(adj1[9], "Double");
strcpy(adj2[0], "Cold");
strcpy(adj2[1], "Hot");
strcpy(adj2[2], "Happy");
strcpy(adj2[3], "Fairly");
strcpy(adj2[4], "Vaguely");
strcpy(adj2[5], "Haunted");
strcpy(adj2[6], "Trecherous");
strcpy(adj2[7], "Wonderous");
strcpy(adj2[8], "Vast");
strcpy(adj2[9], "Tumbling");
strcpy(adj3[0], "Awesome");
strcpy(adj3[1], "Goofy");
strcpy(adj3[2], "Incredible");
strcpy(adj3[3], "Pleasent");
strcpy(adj3[4], "Explosive");
strcpy(adj3[5], "Crazy");
strcpy(adj3[6], "Special");
strcpy(adj3[7], "Mega");
strcpy(adj3[8], "Expensive");
strcpy(adj3[9], "Dissapointing");
strcpy(city[0], "City");
strcpy(city[1], "Town");
strcpy(city[2], "Village");
strcpy(city[3], "Marshland");
strcpy(city[4], "Forrest");
strcpy(city[5], "Mountain");
strcpy(city[6], "Swamp");
strcpy(city[7], "Island");
strcpy(city[8], "Prarie");
strcpy(city[9], "Beach");
ofp = fopen("AwesomePlaces.txt","w");
srand(time(NULL));
for(i=0; i<k; i++)
{
fprintf(ofp, "%s ", adj1[rand() % 10]);
fprintf(ofp, "%s ", adj2[rand() % 10]);
fprintf(ofp, "%s ", adj3[rand() % 10]);
fprintf(ofp, "%s \n\n", city[rand() % 10]);
}
fclose(ofp);
system("start AwesomePlaces.txt");
return 0;
}