Skip to main content

Moving Fish Program In C| BGI | VCMIT

Moving Fish Program In C


IINPUT

#include<stdlib.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
#include<ctype.h>

void main()
{
        int gd=DETECT,gm;
        int xincr=0,newy=0,yincr=5;

        initgraph(&gd,&gm," ");
        cleardevice();
        while(!kbhit())
        {
                ellipse(520-xincr,200,30,330,90,30);
                circle(450-xincr,193,3);
                line(430-xincr,200,450-xincr,200);
                line(597-xincr,185,630-xincr,170);
                line(597-xincr,215,630-xincr,227);
                line(630-xincr,170,630-xincr,227);
                line(597-xincr,200,630-xincr,200);
                line(597-xincr,192,630-xincr,187);
                line(597-xincr,207,630-xincr,213);
                line(500-xincr,190,540-xincr,150+newy);
                line(530-xincr,190,540-xincr,150+newy);
                if(xincr>=500)
                        xincr=0;
                if(newy>=82)
                        yincr=-5;
                xincr=xincr+5;
                if(newy<=0)
                        yincr=5;
                newy=newy+yincr;
                delay(50);
                cleardevice();
        }
        cleardevice();
}

OUTPUT



Comments

// Assuming you have fetched the search query and blog posts // Function to calculate the similarity score between search query and post function calculateSimilarity(query, post) { // You can use a similarity algorithm here, like TF-IDF or cosine similarity // Return a score that represents how relevant the post is to the query } // Function to suggest relevant posts based on search query function suggestPosts(searchQuery, blogPosts) { const suggestedPosts = []; for (const post of blogPosts) { const similarityScore = calculateSimilarity(searchQuery, post); if (similarityScore > 0) { suggestedPosts.push({ post, similarityScore }); } } // Sort the suggested posts based on similarity score suggestedPosts.sort((a, b) => b.similarityScore - a.similarityScore); // Return the sorted list of suggested posts return suggestedPosts.map(item => item.post); } // Example usage const searchQuery = "your search query"; const allBlogPosts = [/* array of your blog posts */]; const suggestedPosts = suggestPosts(searchQuery, allBlogPosts); // Now you can display suggestedPosts to the user