Ejemplo n.º 1
0
void read_user_input(char word[])
{
	char SECRET[] = "pink";//create char variable present locally in function
	int i;//int to be used for the for loop. This is a local variable to the function
	
	for(i = 1; (i <= 3); i++)//for loop using i (initialise;condition;increment) in this case it begins at 1 you only have 3 chances ie 1,2,3 not 0,1,2,3
	{
	printf("\nPlease Enter the Secret Word To End The Program\n");//ask user to enter the secret word
	scanf("%19s", word);// used %19s to stop buffer overflow. remember scanf leaves \n at end
	getchar();//get char captures the end of the array so it allows the program to wait for user in the next function
	
	wait_for_user(word);//The function will now begin
	
	if(strcmp(SECRET, word) == 0)//compares printf will display if true
		{
		printf("\nYOU HAVE GUESSED CORRECTLY THE WORD WAS: %s\n", SECRET);
		break;//break is used as if the statement above is true it will end the loop
		}
		
	else
		{
		printf("\n\nGuess again %s was not the right word\n", word);//tell user that "what they entered" was not the right word
		printf("You have guessed %d\\3 \n", i);//This shows the user how many chances they have used ie 1/3.. 2/3.. 3/3
		}
	}

}
Ejemplo n.º 2
0
								//of initialisation, are still
								//in pseudo 8bit data mode
int main() {

	initLCD();
	initTimerAndInput();

	while (1) {

		int m = 0;
		int s = 0;
		int h = 0;

		int i;
		for (i=0; i<1; i++){
			displayTime(m, s, h);
			wait_for_user();
		}

		while (! GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0)){

			if (h == 100) {
				s++;
				h = 0;
				delay_millisec(40); // make up for processing delays
			}
			if (s == 60){
				m++;
				s=0;
			}

			h ++;

			displayTime(m, s, h);
			delay_millisec(7); //resetting display requires 2ms, 8ms delay results in stopwatch
							// running slow, 7ms with 40ms delay every second corrects this
		}

		wait_for_user(); //removes bounce effect

		for (i=0; i<1; i++){
			displayTime(m, s, h);
			wait_for_user();
		}

	}
}
Ejemplo n.º 3
0
void help()//simple help screen so people know how the game works
{
	clear_screen();
	printf("So the whole point of the game is to guess\r\n");
	printf("the name of the movie , don't worry higher and lower \r\n");
	printf("case are both taken into account so that won't matter here\r\n");
	printf("You can guess either the indivual characters or guess the name straight off\r\n");
	wait_for_user();
	options();
}
Ejemplo n.º 4
0
Archivo: q2.c Proyecto: eokeeffe/C-code
void info()
{
	printf("file=%s\r\n",__FILE__);
	printf("line=%d\r\n",__LINE__);
	printf("date=%s\r\n",__DATE__);
	printf("time=%s\r\n",__TIME__);
	printf("C=%d\r\n",__STDC__);
	wait_for_user();
	options();
}
Ejemplo n.º 5
0
void author()//info about the author
{
	clear_screen();
	printf("\nAuthor is Evan O'Keeffe\r\n");
	printf("Started in Febuary 18th 2011\r\n");
	printf("Project 2\r\n");
	printf("Done as part of software engineering 1 2011\r\n");
	printf("Student of University College of Dublin\r\n");
	wait_for_user();
	options();
}
Ejemplo n.º 6
0
void
drmemory_abort(void)
{
    if (op_pause_at_assert) {
        char buf[64];
        /* very useful to have the pid */
        dr_snprintf(buf, BUFFER_SIZE_ELEMENTS(buf),
                    "Dr. Memory is paused at an assert in pid=%d",
                    dr_get_process_id());
        wait_for_user(buf);
    }
    dr_abort();
}
Ejemplo n.º 7
0
void read_out()//reads out the file,included just for the testing purposes and diagnostics on the file
{
	FILE *fopen(),*fp;
	char choice[100];
	int c;

	fp=fopen("film_genie.txt","r");
	c=getc(fp);
	while(c!=EOF)
	{c=getc(fp);putchar(c);}//read out the text file
	fclose(fp);
	wait_for_user();
	options();
}
Ejemplo n.º 8
0
Archivo: q6.c Proyecto: eokeeffe/C-code
void add_to_record()//add to the record
{
	char dummy;

	printf("Please enter the name of the costumer\r\n");
	scanf("%s",a.name);
	dummy=getchar();
	
	printf("Please enter the address of the costumer\r\n");
	scanf("%s",a.street);
	dummy=getchar();
	
	printf("Please enter the city of the costumer\r\n");
	scanf("%s",a.city);
	dummy=getchar();
	
	printf("Please enter the account number of the costumer\r\n");
	scanf("%d",&a.acct_no);
	dummy=getchar();
	
	printf("Please enter the account number of the costumer\r\n");
	scanf("%c",&a.acct_type);
	dummy=getchar();
	
	printf("Please enter the old balance of the costumer(float)\r\n");
	scanf("%f",&a.oldbalance);
	dummy=getchar();
	
	printf("Please enter the new balance of the costumer(float)\r\n");
	scanf("%f",&a.newbalance);
	dummy=getchar();
	
	printf("Please enter the payment of the costumer(float)\r\n");
	scanf("%f",&a.payment);
	dummy=getchar();
	
	printf("Please enter the date of last transaction of the costumer\r\n");
	printf("day/month/year in numbers please\r\n");
	scanf("%d/%d/%d",&a.lastpayment.day,&a.lastpayment.month,&a.lastpayment.year);
	dummy=getchar();
	
	fp=fopen("1.dat","a");
	fprintf(fp,"\n%s %s %s %d %c %f %f %f %d %d %d",a.name,a.street,a.city,&a.acct_no,a.acct_type,&a.oldbalance,&a.newbalance,&a.payment,&a.lastpayment.day,&a.lastpayment.month,&a.lastpayment.year);
	printf("update complete\r\n");
	fclose(fp);
	
	wait_for_user();
	main();
}
Ejemplo n.º 9
0
void keylognumber(int n) /*log the number of shifts for later decrption*/
{
	FILE *fopen(),*keyn;
	char towrite[200];
	
	wait_for_user();
	printf("please enter the name you want for the encryted key file\r\n");
	gets(towrite);
	
	
	keyn=fopen(towrite,"w");
	fprintf(keyn,"%d",n);
	
	if(keyn==NULL){printf("error file wasn't written to\r\n");}
	fclose(keyn);
}
Ejemplo n.º 10
0
Archivo: q2.c Proyecto: eokeeffe/C-code
void search_file_ini()//search the file
{
	fp=fopen("employee.dat","r");
	
	int ST=0;	//ST stands for search type
	c=0;
	count=0;
	
	if(check_file(fp)==TRUE)
	{
		fclose(fp);
		printf("Please input a search code\r\n");
		printf("1.by first name\r\n");
		printf("2.by last name\r\n");
		printf("3.By ID number\r\n");
		printf("4.By working hours\r\n");
		printf("5.By tax rate\r\n");
		printf("6.By Income(net)\r\n");
		printf("7.By payment\r\n");
		printf("8.by line\r\n");
		printf("9.back to main menu\r\n");
		scanf("%d",&ST);
		
		switch(ST)
		{
			case 1:{search_file(1);break;}
			case 2:{search_file(2);break;}
			case 3:{search_file(3);break;}
			case 4:{search_file(4);break;}
			case 5:{search_file(5);break;}
			case 6:{search_file(6);break;}
			case 7:{search_file(7);break;}
			case 8:{search_file(8);break;}
			case 9:{options();break;}
			default:{search_file_ini();break;}
		}
	}
	if(check_file(fp)==FALSE)
	{
		NF
		wait_for_user();
		main();
	}
	
}
Ejemplo n.º 11
0
Archivo: q9.c Proyecto: eokeeffe/C-code
int add_parts_to_database()
{
	int loop_counter,new_part_place;
	
	for(loop_counter=0;loop_counter<ARRAY_SIZE;loop_counter++)
	{
		if(list[loop_counter].part_number == 0)
		{
			new_part_place = loop_counter;
			break;
		}
	}
	
	printf("Please enter the part name \r\n");
	fgets(list[new_part_place].part_name,50,stdin);
	
	printf("Please enter a part section for %s \r\n",list[new_part_place].part_name);
	fgets(list[new_part_place].part_section,50,stdin);
	
	printf("Please enter the part number\r\n");
	while( scanf("%d",&list[new_part_place].part_number) != 1)
	{
		fflush(stdin);
	}
	
	printf("Please enter the part price\r\n");
	while( scanf("%f",&list[new_part_place].part_price) != 1)
	{
		fflush(stdin);
	}
	
	printf("Please enter the part rating\r\n");
	while( scanf("%lf",&list[new_part_place].part_rating) != 1)
	{
		fflush(stdin);
	}
	
	update_database();
	
	wait_for_user();
	menu();
	return 0;
}
Ejemplo n.º 12
0
int main(void)
{ Attributes attr;
  WORD result;
  
  printf("\f\t\tANSI Terminal Emulation Test\n");
  printf(  "\t\t============================\n\n\n");
  
  setvbuf(stdin, NULL, _IONBF, 0);
  if ((result = GetAttributes(Heliosno(stdout), &attr)) < 0)
   { printf("Failed to get stdout attributes : %lx. Exiting.\n", result);
     exit((int)result);
   }

  printf("Window size : %d rows, %d columns.\n\n", attr.Min, attr.Time);
  rows = attr.Min; cols = attr.Time;
  AddAttribute(&attr, ConsoleRawOutput);
  RemoveAttribute(&attr, ConsolePause);
  RemoveAttribute(&attr, ConsoleEcho);
  
  if ((result = SetAttributes(Heliosno(stdout), &attr)) < 0)
   { printf("Failed to set stdout attributes : %lx. Exiting.\n", result);
     exit((int)result);
   }
   
  if ((result = GetAttributes(Heliosno(stdin), &attr)) < 0)
   { printf("Failed to get stdin attributes : %lx. Exiting.\n", result);
     exit((int)result);
   }

  AddAttribute(&attr, ConsoleRawInput);
  RemoveAttribute(&attr, ConsolePause);
  RemoveAttribute(&attr, ConsoleEcho);
  
  if ((result = SetAttributes(Heliosno(stdin), &attr)) < 0)
   { printf("Failed to set stdin attributes : %lx. Exiting.\n", result);
     exit((int) result);
   }
   
  wait_for_user();
  main_menu();
  printf("\r\n\n\n");
}
Ejemplo n.º 13
0
Archivo: q9.c Proyecto: eokeeffe/C-code
int print_database()
{
	int loop_counter;
	
	for(loop_counter=0;loop_counter<ARRAY_SIZE;loop_counter++)
	{
		if(list[loop_counter].part_number != 0)
		{
			printf("Part Name    : %s \r\n",list[loop_counter].part_name);
			printf("Part section : %s \r\n",list[loop_counter].part_section);
			printf("Part number  : %d \r\n",list[loop_counter].part_number);
			printf("Price        : %.2f \r\n",list[loop_counter].part_price);
			printf("part rating  : %.2lf \r\n\n",list[loop_counter].part_rating);
			
			wait_for_user();
		}
	}
	
	return 0;
}
Ejemplo n.º 14
0
void read_out()
{
	int k=0;
	FILE *fopen(),*fp;
	int count;
	fp=fopen("database.txt","r");

	if(check_file(fp)==0){printf("Problem reading the file SLOTS_BEST_productN.txt, have you created it yet?\r\n");}
	else
		{
			count=getc(fp);
			while(count!=EOF)
			{
				count=getc(fp);
				putchar(count);
			}
		}//open the file and put the characters onto the screen
	fclose(fp);
	wait_for_user();
}
Ejemplo n.º 15
0
void options()//show the options
{
	int user_choice;
	clear_screen();
	fflush(stdin);
	printf("Welcome to Film Genie version 1.0\r\n");
	printf("Please input a number for the option\r\n");
	printf("1.Play Film Genie\r\n");
	printf("2.Help\r\n");
	printf("3.Author\r\n");
	printf("4.Exit\r\n");
	scanf("%d",&user_choice);
	dummy=getchar();
	if(user_choice==1){read_file();}
	if(user_choice==2){help();}
	if(user_choice==3){author();}
	if(user_choice==4){end_all();}
	if(user_choice==5){read_out();}//mainly for diagnostics on the file
	else
	{printf("Please try again with a number specified\r\n");wait_for_user();options();}

}
Ejemplo n.º 16
0
Archivo: q6.c Proyecto: eokeeffe/C-code
void read_file()//read the file user input by user input
{
	fp=fopen("1.dat","r");
	
	if(check_file(fp)==true)
	{
		while(fscanf(fp,"%s %s %s %d %c %f %f %f %d %d %d",a.name,a.street,a.city,&a.acct_no,&a.acct_type,&a.oldbalance,&a.newbalance,&a.payment,&a.lastpayment.day,&a.lastpayment.month,&a.lastpayment.year)!=EOF)
		{
			printf("name: %s\nstreet: %s\ncity: %s\nacc_num: %d\nacct_type: %c\nob: %f\nnb: %f\npayment: %f\ndate: %d %d %d\r\n",a.name,a.street,a.city,a.acct_no,a.acct_type,a.oldbalance,a.newbalance,a.payment,a.lastpayment.day,a.lastpayment.month,a.lastpayment.year);
			printf("\n");
			wait_for_user();
		}
		fclose(fp);
		main();
	}
	if(check_file(fp)==false)
	{
		fclose(fp);
		printf("file not there1\r\n");
		exit(0);
	}
}
Ejemplo n.º 17
0
Archivo: q2.c Proyecto: eokeeffe/C-code
void search_file(int n)
{
	c=0;i=0;
	count=0;
	fp=fopen("employee.dat","r");
	c=getc(fp);
	while(c!=EOF){if(c=='\n'){count++;}c=getc(fp);}
	fclose(fp);
	fp=fopen("employee.dat","r");	
	while(i<=count)
	{
		fscanf(fp,"%d %s %s %lf %lf %d %lf %lf",&DB[i].id,&DB[i].ln,&DB[i].fn,&DB[i].wh,&DB[i].pay,&DB[i].tax,&DB[i].g_inc,&DB[i].n_inc);
		i++;
	}
	fclose(fp);
	//LINEN
	
	switch(n)
	{
		case 1:
		{
			printf("Please enter a first name\r\n");
			scanf("%s",&A.fn);
			for(i=0;i<=count;i++)
			{
				if(strcmp(A.fn,DB[i].fn)==0)
				{
					printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
					printf("Is this the person you are looking for?\r\n");
					printf("Y or N\r\n");
					scanf("%s",&answer1);
					if(answer1[0]=='y'||answer1[0]=='Y'){break;}
				}
			}
			printf("i=%d,%d=count\r\n",i,count);
			if(i==(count+1)){NEMP}
			wait_for_user();
			printf("Would you like to search again?\r\n");
			printf("Y to search again , N to go back to main menu\r\n");
			scanf("%s",&answer1);
			if(answer1[0]=='y'||answer1[0]=='Y'){search_file_ini();}
			else
				{options();}
			break;
		}
		
		case 2:
		{
			printf("Please enter a last name\r\n");
			scanf("%s",&A.ln);
			for(i=0;i<=count;i++)
			{
				if(strcmp(A.ln,DB[i].ln)==0)
				{
					printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
					printf("Is this the person you are looking for?\r\n");
					printf("Y or N\r\n");
					scanf("%s",&answer1);
					if(answer1[0]=='y'||answer1[0]=='Y'){break;}
				}
			}
			printf("i=%d,%d=count\r\n",i,count);
			if(i==(count+1)){NEMP}
			wait_for_user();
			printf("Would you like to search again?\r\n");
			printf("Y to search again , N to go back to main menu\r\n");
			scanf("%s",&answer1);
			if(answer1[0]=='y'||answer1[0]=='Y'){search_file_ini();}
			else
				{options();}
			break;
		}
		
		case 3:
		{
			printf("Please enter the ID\r\n");
			scanf("%d",&A.id);
			for(i=0;i<=count;i++)
			{
				if(A.id==DB[i].id)
				{
					printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
					printf("Is this the person you are looking for?\r\n");
					printf("Y or N\r\n");
					scanf("%s",&answer1);
					if(answer1[0]=='y'||answer1[0]=='Y'){break;}
				}
			}
			printf("i=%d,%d=count\r\n",i,count);
			if(i==count){NEMP}
			wait_for_user();
			printf("Would you like to search again?\r\n");
			printf("Y to search again , N to go back to main menu\r\n");
			scanf("%s",&answer1);
			if(answer1[0]=='y'||answer1[0]=='Y'){search_file_ini();}
			else
				{options();}
			break;
		}
		
		case 4:
		{
			printf("Please enter the working hours\r\n");
			scanf("%lf",&A.wh);
			for(i=0;i<=count;i++)
			{
				if(A.wh==DB[i].wh)
				{
					printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
					printf("Is this the person you are looking for?\r\n");
					printf("Y or N\r\n");
					scanf("%s",&answer1);
					if(answer1[0]=='y'||answer1[0]=='Y'){break;}
				}
			}
			printf("i=%d,%d=count\r\n",i,count);
			if(i==count){NEMP}
			wait_for_user();
			printf("Would you like to search again?\r\n");
			printf("Y to search again , N to go back to main menu\r\n");
			scanf("%s",&answer1);
			if(answer1[0]=='y'||answer1[0]=='Y'){search_file_ini();}
			else
				{options();}
			break;
		}
		
		case 5:
		{
			printf("Please enter the tax\r\n");
			scanf("%d",&A.tax);
			for(i=0;i<=count;i++)
			{
				if(A.tax==DB[i].tax)
				{
					printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
					printf("Is this the person you are looking for?\r\n");
					printf("Y or N\r\n");
					scanf("%s",&answer1);
					if(answer1[0]=='y'||answer1[0]=='Y'){break;}
				}
			}
			printf("i=%d,%d=count\r\n",i,count);
			if(i==count){NEMP}
			wait_for_user();
			printf("Would you like to search again?\r\n");
			printf("Y to search again , N to go back to main menu\r\n");
			scanf("%s",&answer1);
			if(answer1[0]=='y'||answer1[0]=='Y'){search_file_ini();}
			else
				{options();}			
			break;
		}
		
		case 6:
		{
			printf("Please enter an income\r\n");
			scanf("%lf",&A.n_inc);
			for(i=0;i<=count;i++)
			{
				if(A.n_inc==DB[i].n_inc)
				{
					printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
					printf("Is this the person you are looking for?\r\n");
					printf("Y or N\r\n");
					scanf("%s",&answer1);
					if(answer1[0]=='y'||answer1[0]=='Y'){break;}
				}
			}
			printf("i=%d,%d=count\r\n",i,count);
			if(i==count){NEMP}
			wait_for_user();
			printf("Would you like to search again?\r\n");
			printf("Y to search again , N to go back to main menu\r\n");
			scanf("%s",&answer1);
			if(answer1[0]=='y'||answer1[0]=='Y'){search_file_ini();}
			else
				{options();}
			break;
		}
		
		case 7:
		{
		printf("Please enter a payment\r\n");
		scanf("%lf",&A.pay);
		for(i=0;i<=count;i++)	
		{
			if(A.pay==DB[i].pay)
			{
				printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
				printf("Is this the person you are looking for?\r\n");
				printf("Y or N\r\n");
				scanf("%s",&answer1);
				if(answer1[0]=='y'||answer1[0]=='Y'){break;}
			}
		}
		printf("i=%d,%d=count\r\n",i,count);
		if(i==count){NEMP}
		else
			{
			wait_for_user();
			printf("Would you like to search again?\r\n");
			printf("Y to search again , N to go back to main menu\r\n");
			scanf("%s",&answer1);
			if(answer1[0]=='y'||answer1[0]=='Y'){search_file_ini();}
			else
				{options();}
			}
		break;
		}
		
		default:
		{
			for(i=0;i<=count;i++)
			{
				printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
				printf("Is this the person you are looking for?\r\n");
				printf("Y or N\r\n");
				scanf("%s",&answer1);
				if(answer1[0]=='y'||answer1[0]=='Y'){break;}
			}
			printf("i=%d,%d=count\r\n",i,count);
			if(i==count){NEMP}
			else
			{
				wait_for_user();
				printf("Would you like to search again?\r\n");
				printf("Y to search again , N to go back to main menu\r\n");
				scanf("%s",&answer1);
				if(answer1[0]=='y'||answer1[0]=='Y'){search_file_ini();}
				else
					{options();}
			}
			break;
		}
		
	}
	wait_for_user();
	options();
}
Ejemplo n.º 18
0
void create_file()//becuase i don't like it when someone doesn't take into account what would happen if the film file wasn't included
{//this creates the file if it doesn't exist
	char* name0="The Godfather";
	char* name1="Citizen Kane";
	char* name2="Casablanca";
	char* name3="Chinatown";
	char* name4="Raging Bull";
	char* name5="La Dolce Vita";
	char* name6="Gone With The Wind";
	char* name7="Some Like It Hot";
	char* name8="Singing In The Rain";
	char* name9="Psycho";
	char* name10="Seven Samurai";
	char* name11="The Searchers";
	char* name12="The Gold Rush";
	char* name13="Star Wars";
	char* name14="On The Waterfront";
	char* name15="Lawrence of Arabia";
	char* name16="Vertigo";
	char* name17="All About Eve";
	char* name18="The Bicycle Thief";
	char* name19="Snow White And The Seven Dwarfs";
	char* name20="Bringing Up Baby";
	char* name21="Intolerance";
	char* name22="A Space Odyssey";
	char* name23="The Grapes of Wrath";
	char* name24="Sunset Boulevard";
	char* name25="Pulp Fiction";
	char* name26="Mr. Smith Goes to Washington";
	char* name27="The Maltese Falcon";
	char* name28="The Wizard of Oz";
	char* name29="Jules and Jim";
	char* name30="The Philadelphia Story";
	char* name31="Blue Velvet";
	char* name32="Nashville";
	char* name33="Swing Time";
	char* name34="Schindlers List";
	char* name35="Taxi Driver";
	char* name36="Aliens";
	char* name37="Duck Soup";
	char* name38="North By Northwest";
	char* name39="The Seventh Seal";
	char* name40="The Bridge On The River Kwai";
	char* name41="King Kong";
	char* name42="Bonnie And Clyde";
	char* name43="Sweet Smell of Success";
	char* name44="Double Indemnity";

	FILE *fopen(),*fp;
	fp=fopen("film_genie.txt","w");//create a file with this layout
	fprintf(fp,"%s\n",name0);
	fprintf(fp,"%s\n",name1);
	fprintf(fp,"%s\n",name2);
	fprintf(fp,"%s\n",name3);
	fprintf(fp,"%s\n",name4);
	fprintf(fp,"%s\n",name5);
	fprintf(fp,"%s\n",name6);
	fprintf(fp,"%s\n",name7);
	fprintf(fp,"%s\n",name8);
	fprintf(fp,"%s\n",name9);
	fprintf(fp,"%s\n",name10);
	fprintf(fp,"%s\n",name11);
	fprintf(fp,"%s\n",name12);
	fprintf(fp,"%s\n",name13);
	fprintf(fp,"%s\n",name14);
	fprintf(fp,"%s\n",name15);
	fprintf(fp,"%s\n",name16);
	fprintf(fp,"%s\n",name17);
	fprintf(fp,"%s\n",name18);
	fprintf(fp,"%s\n",name19);
	fprintf(fp,"%s\n",name20);
	fprintf(fp,"%s\n",name21);
	fprintf(fp,"%s\n",name22);
	fprintf(fp,"%s\n",name23);
	fprintf(fp,"%s\n",name24);
	fprintf(fp,"%s\n",name25);
	fprintf(fp,"%s\n",name26);
	fprintf(fp,"%s\n",name27);
	fprintf(fp,"%s\n",name28);
	fprintf(fp,"%s\n",name29);
	fprintf(fp,"%s\n",name30);
	fprintf(fp,"%s\n",name31);
	fprintf(fp,"%s\n",name32);
	fprintf(fp,"%s\n",name33);
	fprintf(fp,"%s\n",name34);
	fprintf(fp,"%s\n",name35);
	fprintf(fp,"%s\n",name36);
	fprintf(fp,"%s\n",name37);
	fprintf(fp,"%s\n",name38);
	fprintf(fp,"%s\n",name39);
	fprintf(fp,"%s\n",name40);
	fprintf(fp,"%s\n",name41);
	fprintf(fp,"%s\n",name42);
	fprintf(fp,"%s\n",name43);
	fprintf(fp,"%s\n",name44);
	fclose(fp);
	printf("Film_genie.txt was created\r\n");//tell the user it was made
	wait_for_user();
	options();
}
Ejemplo n.º 19
0
void add_part()
{
	char add[100];
	char reply[100];
	int productN[100],quantityN[100];
	char name[100],create[100],character;
	char user[20];
	int adda,i=0,amount;
	
	FILE *fopen(),*fp;
	fp=fopen("database.txt","r");
	if(check_file(fp)==0){printf("file doesn't exists\r\n");}
	
	else
	{	
		
		fclose(fp);
		printf("Please enter the name of the part your adding\r\n");
		scanf("%s",add);
		//printf("You entered %s\r\n",add);
		fp=fopen("database.txt","r");
		i=0;
		while(fscanf(fp,"%s %d %d",name,&productN[i],&quantityN[i])!=EOF)//scan all the lines  until the end
		{
			if(strcmp(name,add)==0){printf("\nproduct=%s number=%d and quantity=%d already exists\r\n",name,productN[i],quantityN[i]);exit(0);}
			i++;
			/*printf("i=%d and counter=%d\r\n",i,counter);*/
		}
		fclose(fp);
		i=0;
		
		//printf("place 1\r\n");
		printf("Please enter the product number \r\n");
		scanf("%d",&adda);
		
		fp=fopen("database.txt","r");
		i=0;
		while(fscanf(fp,"%s %d %d",name,&productN[i],&quantityN[i])!=EOF)//scan all the lines  until the end
		{
			if(productN[i]==adda){printf("\nproduct=%s number=%d and quantity=%d already exists\r\n",name,productN[i],quantityN[i]);}
			i++;
			/*printf("i=%d and counter=%d\r\n",i,counter);*/
		}
		fclose(fp);
		i=0;
		
		printf("How much will be in the WareHouse \r\n");
		scanf("%d",&amount);
		fclose(fp);

		printf("So you have a product name as: %s\r\n",add);
		printf("product number as: %d\r\n",adda);
		printf("and there is: %d  \r\n",amount);
		printf("Is this right Y/N\r\n");
		scanf("%s",reply);
		
		if(reply[0]=='N'||reply[0]=='n'){printf("Please enter your values again\r\n");wait_for_user();main();}
		else 
			{
				fp=fopen("database.txt","a");
				fprintf(fp,"%s %d %d\r\n",add,adda,amount);
				printf("Database updated,thank you\r\n");
				fclose(fp);
				wait_for_user();
			}
	}
	
}
Ejemplo n.º 20
0
Archivo: q6.c Proyecto: eokeeffe/C-code
void open_file(char* who)
{
	int i=0,comparison=0,comparison1=0;
	int string_lenght=0;
	char dummy;
	
	string_lenght=strlen(who);
	printf("lenght =%d\r\n",string_lenght);
	fp=fopen("1.dat","rw");
	while(fscanf(fp,"%s %s %s %d %c %f %f %f %d %d %d",a.name,a.street,a.city,&a.acct_no,&a.acct_type,&a.oldbalance,&a.newbalance,&a.payment,&a.lastpayment.day,&a.lastpayment.month,&a.lastpayment.year)!=EOF)
		{
			while(comparison1<string_lenght){if(who[comparison]==a.name[comparison]){comparison++;}comparison1++;}
			printf("who=%s and DB name = %s\r\n",who,a.name);
			if(strcmp(who,a.name)==0){break;}
			i++;
			string_lenght=0;
		}
		fclose(fp);
	printf("Name =%s\r\n",a.name);
	
	printf("Please enter the new address of the costumer\r\n");
	scanf("%s",a.street);
	dummy=getchar();
	
	printf("Please enter the new city of the costumer\r\n");
	scanf("%s",a.city);
	dummy=getchar();
	
	printf("Please enter the new account number of the costumer\r\n");
	scanf("%d",&a.acct_no);
	dummy=getchar();
	
	printf("Please enter the new account type of the costumer\r\n");
	scanf("%c",&a.acct_type);
	dummy=getchar();
	
	printf("Please enter the new old balance of the costumer(float)\r\n");
	scanf("%f",&a.oldbalance);
	dummy=getchar();
	
	printf("Please enter the new new balance of the costumer(float)\r\n");
	scanf("%f",&a.newbalance);
	dummy=getchar();
	
	printf("Please enter the new payment of the costumer(float)\r\n");
	scanf("%f",&a.payment);
	dummy=getchar();
	
	printf("Please enter the new date of last transaction of the costumer\r\n");
	printf("day/month/year in numbers please\r\n");
	scanf("%d/%d/%d",&a.lastpayment.day,&a.lastpayment.month,&a.lastpayment.year);
	dummy=getchar();
	
	fp=fopen("1.dat","a");
	fprintf(fp,"\n%s %s %s %d %c %f %f %f %d %d %d",a.name,a.street,a.city,&a.acct_no,a.acct_type,&a.oldbalance,&a.newbalance,&a.payment,&a.lastpayment.day,&a.lastpayment.month,&a.lastpayment.year);
	printf("update complete\r\n");
	fclose(fp);
	
	wait_for_user();
	main();
	
}
Ejemplo n.º 21
0
int main(void)
{ Object *root_obj = Locate(NULL, "/");
  Object *mouse_obj;
  Object *keyboard_obj;
  Attributes attr;
  WORD result;
  
  setvbuf(stdin, NULL, _IONBF, 0);
  if ((result = GetAttributes(Heliosno(stdin), &attr)) < 0)
   { printf("Failed to get stdin attributes : %x. Exiting.\n", result);
     exit(result);
   }

  AddAttribute(&attr, ConsoleRawOutput);
  AddAttribute(&attr, ConsoleRawInput);
  RemoveAttribute(&attr, ConsolePause);
  RemoveAttribute(&attr, ConsoleEcho);
  
  if ((result = SetAttributes(Heliosno(stdin), &attr)) < 0)
   { printf("Failed to set stdin attributes : %x. Exiting.\n", result);
     exit(result);
   }
    
  printf("\f\t\tX Support Test\r\n");
  printf(  "\t\t==============\r\n\n\n");

  mouse_obj = Locate(root_obj, "/mouse");
  if (mouse_obj eq Null(Object))
    { printf("Failed to find a mouse device : %x.\r\n", Result2(root_obj));
      exit(Result2(root_obj));
    }
    
  printf("Found a mouse server : %s.\r\n", mouse_obj->Name);
  mouse_stream = Open(mouse_obj, NULL, O_ReadOnly);
  if (mouse_stream eq Null(Stream))
   { printf("Failed to open stream : %x.\n", Result2(mouse_obj));
     exit(Result2(mouse_obj));
   }
  Close(mouse_obj);
  
  keyboard_obj = Locate(root_obj, "/keyboard");
  if (keyboard_obj eq Null(Object))
    { printf("Failed to find a keyboard device : %x.\r\n", Result2(root_obj));
      exit(Result2(root_obj));
    }
    
  printf("Found a keyboard server : %s.\r\n", keyboard_obj->Name);
  keyboard_stream = Open(keyboard_obj, NULL, O_ReadOnly);
  if (keyboard_stream eq Null(Stream))
   { printf("Failed to open stream : %x.\n", Result2(keyboard_obj));
     exit(Result2(keyboard_obj));
   }
  Close(keyboard_obj);

  Close(root_obj);   
  wait_for_user();
  main_menu();
  Close(mouse_stream);
  Close(keyboard_stream);
  printf("\r\n\n\n");
  return(0);
}
Ejemplo n.º 22
0
Archivo: q2.c Proyecto: eokeeffe/C-code
void change_record()//change something in the database
{
	fp=fopen("employee.dat","r");
	if(check_file(fp)==TRUE)
	{
		fclose(fp);
		c=0;i=0;
		count=0;
		fp=fopen("employee.dat","r");
		c=getc(fp);
		while(c!=EOF){if(c=='\n'){count++;}c=getc(fp);}
		fclose(fp);
		fp=fopen("employee.dat","r");	
		while(i<=count)
		{
			fscanf(fp,"%d %s %s %lf %lf %d %lf %lf",&DB[i].id,&DB[i].ln,&DB[i].fn,&DB[i].wh,&DB[i].pay,&DB[i].tax,&DB[i].g_inc,&DB[i].n_inc);
			i++;
		}
		fclose(fp);
		//LINEN
		
		printf("Please input a search code\r\n");
		printf("1.by first name\r\n");
		printf("2.by last name\r\n");
		printf("3.By ID number\r\n");
		scanf("%d",&answer);
		
		switch(answer)
		{
			case 1:
			{
				printf("Please enter a first name\r\n");
				scanf("%s",&A.fn);
				for(i=0;i<=count;i++)
				{
					if(strcmp(A.fn,DB[i].fn)==0)
					{
						printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
						printf("Is this the person you are looking for?\r\n");
						printf("Y or N\r\n");
						scanf("%s",&answer1);
						if(answer1[0]=='y'||answer1[0]=='Y'){break;}
					}
				}
				//printf("i=%d,%d=count\r\n",i,count);
				if(i==(count+1)){NEMP}
				else
				{
					wait_for_user();
					printf("Are you sure you want to change this person?\r\n");
					printf("Y to change , N to go back to main menu\r\n");
					scanf("%s",&answer2);
					if(answer2[0]=='y'||answer2[0]=='Y'){change_file(i);}
					else
						{options();}
				}
				break;
			}
			
			case 2:
			{
				printf("Please enter a last name\r\n");
				scanf("%s",&A.ln);
				for(i=0;i<=count;i++)
				{
					if(strcmp(A.ln,DB[i].ln)==0)
					{
						printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
						printf("Is this the person you are looking for?\r\n");
						printf("Y or N\r\n");
						scanf("%s",&answer2);
						if(answer2[0]=='y'||answer2[0]=='Y'){break;}
					}
				}
				//printf("i=%d,%d=count\r\n",i,count);
				if(i==(count+1)){NEMP}
				else
				{
					wait_for_user();
					printf("Are you sure you want to change this person?\r\n");
					printf("Y to change , N to go back to main menu\r\n");
					scanf("%s",&answer2);
					if(answer2[0]=='y'||answer2[0]=='Y'){change_file(i);}
					else
						{options();}
				}
				break;
			}
			
			default:
			{
				printf("Please enter the ID\r\n");
				scanf("%d",&A.id);
				for(i=0;i<=count;i++)
				{
					if(A.id==DB[i].id)
					{
						printf("\nID:%d\n Lname:%s\n fname:%s\n Hours:%lf\n pay:%lf\n tax:%d\n G-inc:%lf\n N-inc:%lf\r\n",DB[i].id,DB[i].ln,DB[i].fn,DB[i].wh,DB[i].pay,DB[i].tax,DB[i].g_inc,DB[i].n_inc);
						printf("Is this the person you are looking for?\r\n");
						printf("Y or N\r\n");
						scanf("%s",&answer1);
						if(answer1[0]=='y'||answer1[0]=='Y'){break;}
					}
				}
				printf("i=%d,%d=count\r\n",i,count);
				if(i==count){NEMP}
				else
				{
					wait_for_user();
					printf("Are you sure you want to change this person?\r\n");
					printf("Y to change , N to go back to main menu\r\n");
					scanf("%s",&answer2);
					if(answer2[0]=='y'||answer2[0]=='Y'){change_file(i);}
					else
						{options();}
				}
				break;
			}
			
		}
		
		
	}
Ejemplo n.º 23
0
Archivo: q9.c Proyecto: eokeeffe/C-code
int search_database()
{
	int search_type;
	
	printf("Please enter a number for the search type\r\n");
	printf("1. Part Name \r\n");
	printf("2. Part Section \r\n");
	printf("3. Part Number \r\n");
	printf("4. Part Price range\r\n");
	printf("5. Part Rating range\r\n");
	printf("6. Back to Menu \r\n");
	
	while( scanf("%d",&search_type) != 1 )
	{
		fflush(stdin);
	}
	
	switch( search_type )
	{	
		case 1: 
		{	
			char part_name_search[50];
			
			printf("Please enter the name of the part your searching for\r\n");
			fgets(part_name_search,50,stdin);
			
			int loop_counter;
	
			for(loop_counter=0;loop_counter<ARRAY_SIZE;loop_counter++)
			{
				if(strcmp(part_name_search,list[loop_counter].part_name)==0)
				{
					printf("Part Name    : %s \r\n",list[loop_counter].part_name);
					printf("Part section : %s \r\n",list[loop_counter].part_section);
					printf("Part number  : %d \r\n",list[loop_counter].part_number);
					printf("Price        : %.2f \r\n",list[loop_counter].part_price);
					printf("part rating  : %.2lf \r\n\n",list[loop_counter].part_rating);
				}
			}
			
			wait_for_user();
			menu();
			
			break;
		}
		case 2: 
		{	
			char section_search[50];
			
			printf("Please enter the part section your looking for\r\n");
			fgets(section_search,50,stdin);
			
			int loop_counter;
	
			for(loop_counter=0;loop_counter<ARRAY_SIZE;loop_counter++)
			{
				if(strcmp(section_search,list[loop_counter].part_section)==0)
				{
					printf("Part Name    : %s \r\n",list[loop_counter].part_name);
					printf("Part section : %s \r\n",list[loop_counter].part_section);
					printf("Part number  : %d \r\n",list[loop_counter].part_number);
					printf("Price        : %.2f \r\n",list[loop_counter].part_price);
					printf("part rating  : %.2lf \r\n\n",list[loop_counter].part_rating);
				}
			}
			
			wait_for_user();
			menu();
			
			break;
		}
		case 3: 
		{	
			int part_search;
			
			printf("Please enter the part number you wish to search for\r\n");
			
			while( scanf("%d",&part_search) != 1 )
			{
				fflush(stdin);
			}
			
			int loop_counter;
	
			for(loop_counter=0;loop_counter<ARRAY_SIZE;loop_counter++)
			{
				if(part_search == list[loop_counter].part_number)
				{
					printf("Part Name    : %s \r\n",list[loop_counter].part_name);
					printf("Part section : %s \r\n",list[loop_counter].part_section);
					printf("Part number  : %d \r\n",list[loop_counter].part_number);
					printf("Price        : %.2f \r\n",list[loop_counter].part_price);
					printf("part rating  : %.2lf \r\n\n",list[loop_counter].part_rating);
				}
			}
			
			wait_for_user();
			menu();
			
			break;
		}
		case 4: 
		{	
			int price_max , price_min;
			
			printf("Please enter the min and max price range your looking for\r\n");
			
			while( scanf("%d %d",&price_max,&price_min) != 2 )
			{
				fflush(stdin);
			}
			
			int loop_counter;
	
			for(loop_counter=0;loop_counter<ARRAY_SIZE;loop_counter++)
			{
				if(list[loop_counter].part_price <= price_max && list[loop_counter].part_price >= price_min)
				{
					printf("Part Name    : %s \r\n",list[loop_counter].part_name);
					printf("Part section : %s \r\n",list[loop_counter].part_section);
					printf("Part number  : %d \r\n",list[loop_counter].part_number);
					printf("Price        : %.2f \r\n",list[loop_counter].part_price);
					printf("part rating  : %.2lf \r\n\n",list[loop_counter].part_rating);
				}
			}
			
			wait_for_user();
			menu();
			
			break;
		}
		case 5: 
		{	
			int rating_max,rating_min;
			
			printf("Please enter the min and max rating range your looking for\r\n");
			
			while( scanf("%d %d",&rating_max,&rating_min) != 2 )
			{
				fflush(stdin);
			}
			
			int loop_counter;
	
			for(loop_counter=0;loop_counter<ARRAY_SIZE;loop_counter++)
			{
				if(list[loop_counter].part_rating <= rating_max && list[loop_counter].part_rating >= rating_min)
				{
					printf("Part Name    : %s \r\n",list[loop_counter].part_name);
					printf("Part section : %s \r\n",list[loop_counter].part_section);
					printf("Part number  : %d \r\n",list[loop_counter].part_number);
					printf("Price        : %.2f \r\n",list[loop_counter].part_price);
					printf("part rating  : %.2lf \r\n\n",list[loop_counter].part_rating);
				}
			}
			
			wait_for_user();
			menu();
			
			break;
		}
		default:
		{
			wait_for_user();
			menu();
			break;
		}
	}
	
	wait_for_user();
	menu();
	
	return 0;
}
Ejemplo n.º 24
0
char readfile()
{
	FILE *fopen(),*fp;
	char fname[200],a[1000],pattern[200],replace[200];
	int c=0,i=0,j=0,d=0,e=0,f=0,g;
	
	wait_for_user();
	printf("please enter the name of the file to encrpyt\r\n");
	gets(fname);
	fp=fopen(fname,"r");
	
	if(fp==NULL){printf("this file doesn't exist\r\n");}
	
	while(j++!=1000){a[j]='\0';}
	while(e++!=1000){sl[e]='\0';}
	
	c=getc(fp);
	while(c!=EOF)
	{
		c=getc(fp);										/*basically whats happening here is im copying this*/
		a[i]=c;											/*files pieces into the array for ease of use for the next few steps*/
		i++;
	}
	/*printf("the lenght of the file is %d\r\n",i);*/
	fgets(a,999,fp);
	/*printf("a=%s\r\n",a);*/
	d=strlen(a);
	/*printf("the lenght of a=%d\r\n",d);*/
	i=0;										/*reinitialize for the next loop*/
	
	while(a[i]!='\0')
	{	
		if(a[i]>='A'&&a[i]<='Z')
			{
				sl[i]=a[i]+32;
				/*printf("your word  %s \r\n has been changed to  %s \r\n",a,sl);*/		/*debug feature*/
			}
			else{sl[i]=a[i];}
			i++;
			if(a[i]<=1&&a[i]>=9){printf("you have entered numbers , please enter again\r\n");exit(0);}
	}
	fclose(fp);
	printf("lowercase check1 is %s\r\n",sl);					/*originally a debug feature from the previous program , it came in useful here when i wanted to 
																   ask for the letters/words to be replaced by the user, they can see what words they want changed*/
	
	printf("Enter pattern: \r\n");
	gets( pattern );
	printf("Enter replacement: \r\n");
	gets( replace );
	keylogreplacedwords(pattern,replace);
	
	i = 0 ;
	while ( sl[i] != '\0' )		/* not at end of string */
	{
		if ( sl[i] == pattern[0] )	/*Single char pattern */
		{
			putchar(replace[0]);
		}
		else if ( sl[i] != pattern[0] )
		{
			putchar(sl[i]) ;
		}
		
		i = i + 1;
	}
	putchar('\n') ;
	return(*sl);
}
Ejemplo n.º 25
0
void output_text(char *text)
{ clear_screen();
  puts(text);
  wait_for_user();
}
Ejemplo n.º 26
0
void film_genie(char* film)//the function for the film-genie game
{
	fflush(stdin);

	int i=0,count=0,string_length=0,comparison=0,comparison2=0,comparison3=0,x=0,spaces=0;

	char guess[400],guess_upper_string[400],guess_upper;

	char string[(strlen(film))];				//create an array big enough to hold all characters including spaces and null

	for(i=0;i<(strlen(film));i++){string[i]='\0';}	//clean the array so that when it comes to comparisons they will match
	for(i=0;i<400;i++){guess[i]='\0';}				//clean the guess array

	for(i=0;i<strlen(film);i++){string[i]='*';}	//fill the string array with * to show the number of characters that have to be guessed by the user
	string[strlen(film)]='\0';
	//printf("string is size %d after *'s\r\n",strlen(string));		//debug for showing how many stars are in the array

	for(i=0;i<strlen(film);i++){film[i]=toupper(film[i]);}	//convert everything to upper-case
	for(i=0;i<=strlen(film);i++){if(film[i]>64&&film[i]<123||film[i]==32){string_length++;}}
	//get the total number of characters and spaces and nothing else
	for(i=0;i<=strlen(film);i++){if(film[i]==32){spaces++;}}		//count the number of spaces , used in the character number checker
	for(i=0;i<=strlen(film);i++){if(film[i]<65&&film[i]>122&&film[i]!=32){film[i]='\0';}}		//null any characters present in film
	i=0;

	while(count<number_of_tries&&comparison!=(string_length-spaces)&&comparison2!=string_length)
	//if the number of tries goes to far , or they get the full thing
	{
		fflush(stdin);
		clear_screen();
		//printf("higher case film = %s\r\n",film);

		printf("Guess number:%d\r\n",count);
		printf("previous guess was:%s\r\n",guess);
		printf("number of characters=%d\r\n",string_length);
		printf("here is the string so far %s\r\n",string);
		get_choice();

		if(user_answer=='c'||user_answer=='C')
		{
			fflush(stdin);
			printf("\nplease enter a character\r\n");
			scanf("%2s",&guess);
			fflush(stdin);
			//printf("you entered %s\r\n",guess);
			for(i=0;i<=strlen(film);i++)//check for all characters that may match the guess
			{
					guess_upper=toupper(guess[0]);
					if(guess_upper==film[i]){string[i]=guess_upper;comparison++;}//if the guess is right replace the star in string with the character
					//and increment the comparison count(count until all letters have been guessed
			}
			//printf("comp=%d and sl=%d ,counter=%d\r\n",comparison,string_length,i);

			if(comparison==comparison3){count++;printf("Your character doesn't exist! Please continue playing\r\n");}
			//if the guess was incorrect then the comparison will be equal to comparison3
			else{comparison3=comparison;}//else the guess was right
			wait_for_user();
			fflush(stdin);
		}

		if(user_answer=='f'||user_answer=='F')
		{
			fflush(stdin);
			for(i=0;i<400;i++){guess[i]='\0';}
			for(i=0;i<400;i++){guess_upper_string[i]='\0';}
			i=0;

			printf("\nplease enter the full film name\r\n");


			for(x=0;guess[x]!='\r'&&x<=string_length&&guess[x]!='\n';x++){guess[x]=getchar();}
			//because scanf was giving me errors , i wrote my own version of it here
			fflush(stdin);
			//printf("you entered %s\r\n",guess);
			comparison2=0;

			for(i=0;i<=strlen(film);i++)//check for all characters that may match the guess
			{
					guess_upper_string[i]=toupper(guess[i]);
					//printf("guess=%c and film=%c\r\n",guess_upper_string[i],film[i]);
					if(guess_upper_string[i]==film[i]){string[i]=guess_upper_string[i];comparison2++;}
					//if the guess is right replace the star in string with the character
					if(comparison2==string_length){break;}
					//if all characters are matched then the guess is right , also handy if they only mispelled a single part of a long string
			}
			//printf("comp=%d and sl=%d ,counter=%d,string=%s\r\n",comparison2,string_length,comparison3,string);
			if(comparison2!=string_length){count++;}
			if(comparison2==comparison3){printf("Your character doesn't exist! Please continue playing\r\n");}
			//if the guess was incorrect then the comparison will be equal to comparison3
			else
				{comparison3=comparison;}		  //else the guess was right
			wait_for_user();
			fflush(stdin);
		}
		else
			{printf("please try again\r\n");wait_for_user();}

	}

	clear_screen();

	if(count>number_of_tries){printf("sorry but that wasn't the right answer\r\n");printf("%s was the right answer\r\n",film);}
	if(count==5){printf("That was a lucky one , well done\r\n");}
	if(count==0){printf("Your a Genius , well done\r\n");}
	else{printf("Congratulations You Won, %s was the right answer\r\n",film);}

	fflush(stdin);
	for(i=0;i<400;i++){play_again[i]='\0';}
	i=0;
	printf("would you like to continue playing?\r\n");
	printf("Y to continue or N to quit\r\n");
	scanf("%s",&play_again);
	fflush(stdin);
	if(play_again[0]=='y'||play_again[0]=='Y'){read_file();}
	if(play_again[0]=='n'||play_again[0]=='N'){end_all();}
	else
	{
		fflush(stdin);
		for(i=0;i<400;i++){play_again[i]='\0';}
		i=0;
		printf("wrong input, please try again\r\n");
		wait_for_user();
		printf("would you like to continue playing?\r\n");
		printf("Y to continue or N to quit\r\n");
		scanf("%s",&play_again);
		fflush(stdin);
		if(play_again[0]=='y'||play_again[0]=='Y'){read_file();}
		if(play_again[0]=='n'||play_again[0]=='N'){end_all();}
		else
		{
			for(i=0;i<400;i++){play_again[i]='\0';}
			i=0;
			while(i<10)//10 times is trying it really
			{
				printf("\nwould you like to continue playing?\r\n");
				printf("Y to continue or N to quit\r\n");
				scanf("%s",&play_again);
				if(play_again[0]=='y'||play_again[0]=='Y'){read_file();}
				if(play_again[0]=='n'||play_again[0]=='N'){end_all();}
				else{printf("character not recognized, please try again\r\n");i++;}
			}
			if(i==10){clear_screen();printf("Now redirecting you to the main menu , please don't try that again\r\n");wait_for_user();options();}
		}
	}
}