Because all students are important to allteachers... especially one as Pretty as Cydtheresa.
#include<stdio.h> main() { int i,words,spaces; char a[30]; printf("enter the string") ; scanf("%s",a); for(i=0;a[0]!="\0";i++) { if (a[i]=' ') spaces++; } printf("the no. of spaces in the string is %d",spaces); printf("the number of words in the string is %d",spaces+1); }
/*this block of code fineds any given string in tree different filedisplays the string and prints the number of occurences in these file....thats all:)*/package useToken;import java.io.*;class readFile extends StreamTokenizer {readFile(InputStream in ){super(in);}public static void main (String argv[]){try {int ret;String string;BufferedReader in =new BufferedReader (newInputStreamReader(System.in));System.out.print("Enter some text: ");string = in.readLine();String[] file = {"file1.txt","file2.txt","file3.txt"};for(int i=0;i