Should this thread be made Sticky?


  • Total voters
    6
  • Poll closed .
Status
Not open for further replies.

Abhishek Dwivedi

TechFreakiez.com
This thread is for sharing and asking the basic Algorithms related to any Programing language.

Way of Asking:

Programing Language-
Algorithm required-
Program(if made)-
Other Information(if required)-


Important: Users Asking for the Algorithms should try Google search first before posting.

Hope this will help a lot of Young Students and others who are learning the programing methodology
 
Last edited:

Projjwal

free world from money
Programing Language- Any language
Algorithm required-VBR(Variable bit rate) for mp3
Program(if made)-LAME
 

Projjwal

free world from money
^^@Quiz_Master
-----------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

/* Define an array of critters to sort. */

struct critter
{
const char *name;
const char *species;
};

struct critter muppets[] =
{
{"Kermit", "frog"},
{"Piggy", "pig"},
{"Gonzo", "whatever"},
{"Fozzie", "bear"},
{"Sam", "eagle"},
{"Robin", "frog"},
{"Animal", "animal"},
{"Camilla", "chicken"},
{"Sweetums", "monster"},
{"Dr. Strangepork", "pig"},
{"Link Hogthrob", "pig"},
{"Zoot", "human"},
{"Dr. Bunsen Honeydew", "human"},
{"Beaker", "human"},
{"Swedish Chef", "human"}
};

int count = sizeof (muppets) / sizeof (struct critter);



/* This is the comparison function used for sorting and searching. */

int
critter_cmp (const struct critter *c1, const struct critter *c2)
{
return strcmp (c1->name, c2->name);
}


/* Print information about a critter. */

void
print_critter (const struct critter *c)
{
printf ("%s, the %s\n", c->name, c->species);
}


/* Do the lookup into the sorted array. */

void
find_critter (const char *name)
{
struct critter target, *result;
target.name = name;
result = bsearch (&target, muppets, count, sizeof (struct critter),
critter_cmp);
if (result)
print_critter (result);
else
printf ("Couldn't find %s.\n", name);
}

/* Main program. */

int
main (void)
{
int i;

for (i = 0; i < count; i++)
print_critter (&muppets);
printf ("\n");

qsort (muppets, count, sizeof (struct critter), critter_cmp);

for (i = 0; i < count; i++)
print_critter (&muppets);
printf ("\n");

find_critter ("Kermit");
find_critter ("Gonzo");
find_critter ("Janice");

return 0;
}
---------------------------------------
The output from this program looks like:
---------------------------------------
Kermit, the frog
Piggy, the pig
Gonzo, the whatever
Fozzie, the bear
Sam, the eagle
Robin, the frog
Animal, the animal
Camilla, the chicken
Sweetums, the monster
Dr. Strangepork, the pig
Link Hogthrob, the pig
Zoot, the human
Dr. Bunsen Honeydew, the human
Beaker, the human
Swedish Chef, the human

Animal, the animal
Beaker, the human
Camilla, the chicken
Dr. Bunsen Honeydew, the human
Dr. Strangepork, the pig
Fozzie, the bear
Gonzo, the whatever
Kermit, the frog
Link Hogthrob, the pig
Piggy, the pig
Robin, the frog
Sam, the eagle
Swedish Chef, the human
Sweetums, the monster
Zoot, the human

Kermit, the frog
Gonzo, the whatever
Couldn't find Janice.
------------------------------------------
Source:*www.gnu.org/software/libc/manual/html_node/Search_002fSort-Example.html
 
OP
Abhishek Dwivedi

Abhishek Dwivedi

TechFreakiez.com
Programing Language : C++
Algorithms Required: A program to corupt the HDD
Other Information: I've heard its a 3 line program that can destroy the HDD.
 

Zeeshan Quireshi

C# Be Sharp !
Programming Language: C# / .NET 3.0 / Vista

What it Does : Outputs a String as A Voice Message

Code:
using System;
using System.Speech.Synthesis;

namespace HelloSpeechSynthesis
{
    class Program
    {
        static void Main(string[] args)
        {
            SpeechSynthesizer synth = new SpeechSynthesizer();
            synth.SpeakText("Hello, world!");
        }
    }
}
 

QwertyManiac

Commander in Chief
Projjwal said:
Programing Language- Any language
Algorithm required-VBR(Variable bit rate) for mp3
Program(if made)-LAME
Wont running LAME with the parameter -v do it? You can resample the bitrate to 64, 128 etc along too. Or did I not understand what you were asking ...
 

Projjwal

free world from money
^^
Yea I want a programming code in any language which convert normal mp3 to VBR mp3 just like LAME's -v option.
In other word de algo to convert normal mp3 to VBR mp3.

----------------------------------------------
Programing Language-C,C++
Algorithm required-A program which support all the command of cmd
Program(if made)-I want to access all the command of cmd throug my application
As example if i type cd <directory_name> in that application it automatically create a directory with the name just like cmd.
I did it in VB6 but that logic not applied on c or c++ pls help.
 
Last edited:

mehulved

18 Till I Die............
Projjwal said:
As example if i type cd <directory_name> in that application it automatically create a directory with the name just like cmd.
I did it in VB6 but that logic not applied on c or c++ pls help.
I know that vim can do similar sort of thing, atleast on *nix. So, maybe you can check out the win32 port of vim if it has something similar and if it can help you.
 

mehulved

18 Till I Die............
vim is a text editor. Check the source code of win32 port of vim, you might be able to find what you need. See *www.vim.org/download.php#pc
 

Zeeshan Quireshi

C# Be Sharp !
Projjwal said:
^^
Yea I want a programming code in any language which convert normal mp3 to VBR mp3 just like LAME's -v option.
In other word de algo to convert normal mp3 to VBR mp3.

----------------------------------------------
Programing Language-C,C++
Algorithm required-A program which support all the command of cmd
Program(if made)-I want to access all the command of cmd throug my application
As example if i type cd <directory_name> in that application it automatically create a directory with the name just like cmd.
I did it in VB6 but that logic not applied on c or c++ pls help.
well u can do this simply by taking the input as a string and then passing the command onto the system using the system() function .
 

Projjwal

free world from money
Yea.....sending through system() is true. but wht about the output of the cmd
window in my application window?
 
Status
Not open for further replies.
Top Bottom