Postingan

Menampilkan postingan dengan label programs

Stemming of a file in c++ | What is Stemming in IR

Gambar
Programming yes post of programming. This post may b unique over the internet a Program of Stemming of File in C++ , Last week while Working over a Project of Boolean Search Engine in C++ . I have to cope with a  problem and Project requirement was also to Use stemming. So I complete by the project with following a code of stemming . What is Stemming of a File: A common processing step in many IR(information retrieval) systems is called stemming. The main idea behind stemming is that users searching for information on “serving” will also be interested in documents that have information containing “served”, “r”, “serve”, and so on all worlds which are related to search query. Systems can be susceptible to errors due to poor stemming, so this is a little tricky. For example, a user interested in “information retrieval” might get a document titled “Information on Golden Retrievers” due to stemming. this is used in search engines where we have to find documents containing relevant word...

C# Program to find Area of Triangle

C# Program to find Area of Triangle Program Statement: If the lengths of the sides of a triangle are denoted by a, b, and c, then area of triangle is given by Area = S?S(S-a)(S-b)(S-c) where, S = ( a + b + c ) / 2 Solution: class sq { int a, b, c; double S, Area, temp2; public double s(double t) { double lb = 0, ub = t, temp = 0; int count = 50; while (count != 0) { temp = (lb + ub) / 2; if (temp * temp == t) { return temp; } else if (temp * temp > t) { ub = temp; } else { lb = temp; } count--; } return temp; } public void cal() { Console.Write("\n\t\tEnter value of a : "); a = Convert.ToInt32(Console.ReadLine()); Console.Write("\n\t\tEnter value of b : "); b = Convert.To...

C# Program for Array solving problems

C# Program for Array solving problems Program Statement: Write a function which takes four arrays of same size as arguments; array1, array2, array3, array4. The function will multiply the corresponding values of array1 and array2 and will save the result at same index of array3. i.e. array3[0] = array1[0] * array2[0] and so on. Then create another function and pass all four arrays to that function as argument where you have to compare array1, array2 and array3 and save the max value in array4 i.e. if array1[0] = 10, array2[0] = 5, array3[0]= 11 then you have to save max value i.e. array4[0] = 11. In main function, show all values of array4. Solution: class _arr { public void mul(int n, int[] array1, int[] array2, int[] array3) { for (int i = 0; i < n; i++) { array3[i] = array1[i] * array2[i]; } Console.Write("\nArray3 = Array1 * Array2 : "); for (int i = 0; i < n; i++) ...

C# Main Function for Calling all classes

C# Main Function for Calling all classes void Main_Fun() { int num; Program obj = new Program(); Console.Clear(); Console.ForegroundColor = ConsoleColor.Green; Console.BackgroundColor = ConsoleColor.DarkCyan; Console.WriteLine("\n\t\t\t*****VISUAL PROGRAMMING*****"); Console.WriteLine("\n\t\t\t ****ASSIGNMENT # 1****\n\n"); Console.Write("\nIf Run Project (Y/N) ? "); obj.choice = Convert.ToChar(Console.ReadLine()); if (obj.choice != 'Y' && obj.choice != 'y') { Console.WriteLine("\nSee you Next Time"); } else { Console.Write("\nEnter the Question No. : "); num = Convert.ToInt32(Console.ReadLine()); switch (num) { case 1: ...

C# Program to find Student GPA and CGPA || Concept of ENUM in C#

C# Program to find Student GPA and CGPA Program Statement: Create a class of student which stores characteristcs of student like studentID, studentName, studentDOB, studentRollNo, studentEmail, studentGPA of last 5 semesters and other related information of the student. (You may set some properties Boolean and some readonly) a. Calculate the CGPA of each student using function calculateCGPA(…). b. Student with highest CGPA will be considerd CR of the class. There should be a function which will compare the CGPA of students and will declare a student having greater CGPA as CR. c. Program should be able to take input of 5 students from user; definitely there will be a function which will take input from the user. d. You have to use the Setter for setting the values of the data members of the class and and Getter function for getting the values of the data members of the class. (You can use property as alternative) e. Default value for each student GPA should be 3.0. (You have to use an a...

C# Program which calculated factorial to prime function

C# Program which  calculated factorial to prime function Program Statement: Write two functions max(int,int) and prime(int). max function will take two arguments and will return the maximum of two numbers in main. Then main function will pass this calculated factorial to prime function which will show that passed value is prime or not. Solution : public class _max { public int max(int a, int b) { if (a > b) return a; else return b; } public void prime(int n) { if (n == 1) Console.WriteLine("\n\t\t{0} is maximum but not prime number!\n\n", n); if (n >= 2) { if (n % 2 != 0) { Console.WriteLine("\n\t\t{0} is maximum and Prime number!\n\n", n); } else { Console.WriteLine("\n\t\t{0} is maximum but not a Prime nu...

C# Program to solve different problems

C# Program to solve different problems Program Statement: Write a program which will take input a character ‘a’ value from user. You have to use switch statement to decide if value of a is ‘t’ then you have to call table function, if value of a is ‘f’ then call factorial function, if value of a is ‘p’ then call prime function, if value of a is ‘s’ then call search function. You have to write four functions in your program; Table(int n1,n2) Factorial(int n3) Prime(int n4) Search(char n5[], char c, char choice) Table function will print the table of n1 from 1 to n2. Factorial function will print the factorial of n3 if n3 is multiple of 2. Prime function will print the n4 if n4 is prime. Search function will take first argument n5 as an array of characters and second element a character to be search in the array and third element a character to decide which searching algorithm to be used.i.e. if user has passed the value of c as ‘s’ then Search function will perform the sequential search ...

C# Program which takes n values from user and then sort them using Bubble sort

C# Program which takes n values from user and then sort them using Bubble sort Program Statement: Write a program which takes n values from user and then sort them using Bubble sort Solution: public class bubble { int n, x, y, z; public void sort() { System.Console.Write("\n\t\tEnter length of array : "); n = Convert.ToInt32(System.Console.ReadLine()); int[] array = new int[n + 1]; int[] temp1 = new int[n + 1]; int[] temp2 = new int[n]; System.Console.WriteLine("\n\t\tEnter {0} numbers : ", n); for (x = 0; x < n; x++) { array[x] = Convert.ToInt32(System.Console.ReadLine()); } for (y = n; y > 0; y--) { for (z = 0; z < y; z++) { if (array[z] > array[z + 1]) { temp1[z] = array[z]; ...

C# Program which takes n values from user and then sort them in ascending order

C# Program which takes n values from user and then sort them in ascending order Program Statement: Write a program which takes n values from user and then sort them in ascending order . Solution: public class sort { int n, x, y, z; public void s() { Console.Write("\n\t\tEnter number of values you want to sort : "); n = Convert.ToInt32(Console.ReadLine()); int[] arr = new int[n]; for (int i = 0; i < n; i++) { Console.Write("\n\t\tEnter number : "); arr[i] = Convert.ToInt32(Console.ReadLine()); } for (x = 0; x < n; x++) { for (y = x + 1; y < n; y++) if (arr[x] > arr[y]) { int temp; temp = arr[y]; arr[y] = arr[x]; arr[x] = temp; } ...

C# Program to Print number of prime values in the array

C# Program to Print number of prime values in the array Program Statement: Write a program which takes 10 values from user in an array and then show the number of prime values in the array. Solution: public class arr { int c, count = 0, n; int[] array = new int[10]; public void arr_func() { Console.WriteLine("\n\t\tEnter 10 element only!\n"); for (int x = 0; x < 10; x++) array[x] = Convert.ToInt32(Console.ReadLine()); for (int y = 0; y < 10; y++) { n = array[y]; for (c = 2; c <= n - 1; c++) { if (n % c == 0) { break; } } if (c == n) { count++; Console.WriteLine("\n\t\t{0} is prime number!\n", n); } } Console.WriteLine("\n\t\tNumber of prime values : {0}\n", count); } }