All pastes #1630621 Raw Edit

clueless

public text v1 · immutable
#1630621 ·published 2009-10-19 20:29 UTC
rendered paste body
#include <stdio.h>int main(){	char text[] = "Det här är en text som handlar om saker som är och den texten är häftig som bara den, och det tycker vi ju om. I Love texter som gör sånt";	char ord[20];		printf("Vilket ord vill du kolla efter: ");	scanf("%s",ord);		int i,j, check, times;	check = 0;	times = 0;	int length = 0;	//check how long word is	for(i = 0; ord[i] !='\0'; i++)	{		length++;	}	//see if word is in string		for(i = 0; text[i] != '\0'; i++)	{		for(j = 0; ord[j] != '\0'; j++)		{			if(text[i-1] == ' ' && text[i+length] == ' ')			{				if(text[i+j] == ord[j])				{						check++;				}				else					break;			}			else				break;		}		if(j == length)			times++;	}	printf("I strängen %s \n\n så fanns ordet %s med %d gånger",text,ord,times);}