Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Trebaom Zadatak (C sharp)

[es] :: .NET :: Trebaom Zadatak (C sharp)

[ Pregleda: 3641 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Robert Kilijan
Student

Član broj: 185866
Poruke: 2
*.adsl.net.t-com.hr.



Profil

icon Trebaom Zadatak (C sharp)24.06.2008. u 13:12 - pre 191 meseci
Treba mi zadatak iz c sharpa bilo kakav neka bude malo tezi. Imam zadatak da si zadam nekakav zadatak a naprosto nemam ideja. pomomagajte. nemora biti riješen ali neću se ljutiti ako dođe s rješenjem. pozz
 
Odgovor na temu

Marko Medojević
Team leader
Digital ST
Beograd

Član broj: 93659
Poruke: 776
*.adsl-1.sezampro.yu.

Sajt: www.digitalst.rs


+99 Profil

icon Re: Trebaom Zadatak (C sharp)26.06.2008. u 08:43 - pre 191 meseci
Kakav zadatak? Proceduralno ili objekto programiranje? Koje oblasti uključuje (nizovi, liste, eventi ...)?
 
Odgovor na temu

Robert Kilijan
Student

Član broj: 185866
Poruke: 2
*.adsl.net.t-com.hr.



Profil

icon Re: Trebaom Zadatak (C sharp)30.06.2008. u 17:33 - pre 191 meseci
Najbolje bi bilo da mi iz ovih par primjera probate nešto sastaviti. ili da vam to bude putokaz.

Audio zapis od n minuta treba pohraniti na disk. Izračunati i ispisati koliko će prostora na disku biti potrebno (u MB) za tri slučaja kvalitete zapisa:
16 bita, 44100 Hz, stereo.
16 bita, 22050 Hz, mono
8 bita, 22050 Hz, mono
Trajanje zapisa n zadaje se preko tipkovnice.

ZADATAK
Napisati metodu koja će za x litara benzina izračunati i vratiti maksimalnu moguću duljinu puta koje može postići vozilo sa prosječnom potrošnjom od y litara/100 km. Napisanu metodu pozvati iz metode Main za tri slučaja x i y koje korisnik unosi preko tipkovnice, te ispisati rezultate koje vrati.

ZADATAK
Napisati metodu koja vraća površinu kružnice čiji je polumjer jednak parametru r. U Main metodi ispisati površine kružnica čiji su polumjeri svi cijeli brojevi u intervalu od a do b. (koristiti napisanu metodu za izračunavanje površine). Vrijednosti varijabli a, b zadaju se preko tipkovnice.

ZADATAK
Napisati program koji će ispisati matricu veličine a*b. Elementi matrice su vrijednosti
1, 2, 3, ... n gdje je n ukupan broj elemenata. Vrijednosti a i b se zadaju preko tipkovnice
i ne smiju biti veće od 7. Ukoliko korisnik upiše vrijednost za a ili b veću od 7, umjesto
matrice ispisuje se poruka „Vrijednosti a i b moraju biti manje od 8“.
 
Odgovor na temu

Marko Medojević
Team leader
Digital ST
Beograd

Član broj: 93659
Poruke: 776
*.adsl-a-1.sezampro.yu.

Sajt: www.digitalst.rs


+99 Profil

icon Re: Trebaom Zadatak (C sharp)30.06.2008. u 20:08 - pre 191 meseci
ZADATAK
Napisati metodu koja će za x litara benzina izračunati i vratiti maksimalnu moguću duljinu puta koje može postići vozilo sa prosječnom potrošnjom od y litara/100 km. Napisanu metodu pozvati iz metode Main za tri slučaja x i y koje korisnik unosi preko tipkovnice, te ispisati rezultate koje vrati.

Code:
using System;
using System.Collections.Generic;
using System.Text;

namespace Zadatak1
{
    class Program
    {
        static void Main(string[] args)
        {
            decimal ukupno; // ukupno raspolozivig benzina
            decimal potrosnja; // potrosnja na 100 km

            for (int i = 0; i < 3; i++)
            {
                Console.WriteLine("\n\n***** PROLAZ BROJ {0} *****\n\n", i+1);
                Console.Write("Unesite ukupnu kolicinu benzina: ");
                ukupno = Convert.ToDecimal(Console.ReadLine());
                Console.Write("Unesite potrosnju na 100 km: ");
                potrosnja = Convert.ToDecimal(Console.ReadLine());
                Console.WriteLine("\n\nMaksimalna predjena duzina je {0} km\n\n", Potrosnja(ukupno, potrosnja));
            }
        }


        static decimal Potrosnja(decimal x, decimal y)
        {
            decimal rezultat;
            rezultat = x * (100 / y);
            return rezultat;
        }
    }
}


ZADATAK
Napisati metodu koja vraća površinu kružnice čiji je polumjer jednak parametru r. U Main metodi ispisati površine kružnica čiji su polumjeri svi cijeli brojevi u intervalu od a do b. (koristiti napisanu metodu za izračunavanje površine). Vrijednosti varijabli a, b zadaju se preko tipkovnice.
Code:
using System;
using System.Collections.Generic;
using System.Text;

namespace Zadatak2
{
    class Program
    {
        static void Main(string[] args)
        {
            int a;
            int b;
            Console.Write("Unesite a: ");
            a = Convert.ToInt32(Console.ReadLine());
            Console.Write("Unesite b: ");
            b = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("\n\n");
            for (int i = a; i <= b; i++)
            {
                Console.WriteLine("Za polumjer = {0}, povrsina je {1}\n", i, Pov(i));
            }
        }

        static double Pov(double r)
        {
            double rezultat;
            rezultat = Math.Pow(r, 2) * Math.PI;
            return rezultat;
        }
    }
}


ZADATAK
Napisati program koji će ispisati matricu veličine a*b. Elementi matrice su vrijednosti
1, 2, 3, ... n gdje je n ukupan broj elemenata. Vrijednosti a i b se zadaju preko tipkovnice
i ne smiju biti veće od 7. Ukoliko korisnik upiše vrijednost za a ili b veću od 7, umjesto
matrice ispisuje se poruka „Vrijednosti a i b moraju biti manje od 8“.
Code:
using System;
using System.Collections.Generic;
using System.Text;

namespace Zadatak3
{
    class Program
    {
        static void Main(string[] args)
        {
            int a; // broj redova
            int b; // broj kolona
            while (true)
            {
                Console.Write("Unesite a:");
                a = Convert.ToInt32(Console.ReadLine());
                Console.Write("Unesite b:");
                b = Convert.ToInt32(Console.ReadLine());
                // provera
                if ((a <= 7) && (b <= 7)) break; else Console.WriteLine("MORATE ZA A I B UNETI MANJE ILI JEDNAKO 7!!!\n");
                // provera
            }
            int[,] matrica = new int[a, b];
            for (int i = 0; i < a; i++)
            {
                for (int j = 0; j < b; j++)
                {
                    matrica[i, j] = (j + 1) + i * b;
                }
            }
            for (int i = 0; i < a; i++)
            {
                for (int j = 0; j < b; j++)
                {
                    Console.Write("{0}\t", matrica[i,j]);
                }
                Console.Write("\n");
            }
        }
    }
}


Sve primere imaš u attachmentu!
Prikačeni fajlovi
 
Odgovor na temu

Marko Medojević
Team leader
Digital ST
Beograd

Član broj: 93659
Poruke: 776
*.adsl-a-1.sezampro.yu.

Sajt: www.digitalst.rs


+99 Profil

icon Re: Trebaom Zadatak (C sharp)30.06.2008. u 20:14 - pre 191 meseci
Ovo sam na brzinu pisao ali mislim da je sve ok! Srećno sa C#!
 
Odgovor na temu

Aleksandar Ružičić
Software Architect, Appricot d.o.o.
Beograd

Član broj: 26939
Poruke: 2881

Jabber: krckoorascic@gmail.com
Sajt: krcko.net


+44 Profil

icon Re: Trebaom Zadatak (C sharp)05.07.2008. u 13:35 - pre 191 meseci
evo 1. (najlaksi) zadatak sa Google Code Jam Practice Problems:

Citat:

Problem

The decimal numeral system is composed of ten digits, which we represent as "0123456789" (the digits in a system are written from lowest to highest). Imagine you have discovered an alien numeral system composed of some number of digits, which may or may not be the same as those used in decimal. For example, if the alien numeral system were represented as "oF8", then the numbers one through ten would be (F, 8, Fo, FF, F8, 8o, 8F, 88, Foo, FoF). We would like to be able to work with numbers in arbitrary alien systems. More generally, we want to be able to convert an arbitrary number that's written in one alien system into a second alien system.

Input

The first line of input gives the number of cases, N. N test cases follow. Each case is a line formatted as

alien_number source_language target_language

Each language will be represented by a list of its digits, ordered from lowest to highest value. No digit will be repeated in any representation, all digits in the alien number will be present in the source language, and the first digit of the alien number will not be the lowest valued digit of the source language (in other words, the alien numbers have no leading zeroes). Each digit will either be a number 0-9, an uppercase or lowercase letter, or one of the following symbols !"#$%&'()*+,-./:;<=>?@[]^_`{|}~

Output

For each test case, output one line containing "Case #x: " followed by the alien number translated from the source language to the target language.


Sample

Input

4
9 0123456789 oF8
Foo oF8 0123456789
13 0123456789abcdef 01
CODE O!CDE? A?JM!.


Output

Case #1: Foo
Case #2: 9
Case #3: 10011
Case #4: JAM!


i evo mog resenja:
Code:

/*
 * 
 *  Google Code Jam Practice Problems - Alien Numbers
 * 
 *  usage: aliennumber inputfile.in
 * 
 */

using System;
using System.IO;

namespace Alien_Numbers
{

    class Program
    {
        static void Main( string[] args )
        {
            try
            {
                TextReader input = new StreamReader( args[0] );
                TextWriter output = new StreamWriter( Path.ChangeExtension( args[0], "out" ) );

                int numLines = int.Parse( input.ReadLine() );
                int counter = 0;

                while ( counter++ < numLines )
                {
                    string[] line = input.ReadLine().Split( ' ' );

                    output.WriteLine( "Case #" + counter.ToString() + ": " + fromDecimal( toDecimal( line[0], line[1] ), line[2] ) );
                }

                input.Close();
                output.Close();
            }
            catch ( System.Exception ex )
            {
                Console.WriteLine( ex );
            }
        }

        static int toDecimal( string number, string language )
        {
            int systemBase = language.Length;
            int result = 0;
            int last = number.Length - 1;

            for ( int i = 0; i < number.Length; i++ )
            {
                result += language.IndexOf( number[i] ) * ( int )Math.Pow( systemBase, last - i );
            }

            return result;
        }

        static string fromDecimal( int number, string language )
        {
            string result = "";
            int systemBase = language.Length;

            do
            {
                result = language[number % systemBase] + result;
                number /= systemBase;
                
            } while ( number > 0 );

            return result;
        }
    }
}

 
Odgovor na temu

[es] :: .NET :: Trebaom Zadatak (C sharp)

[ Pregleda: 3641 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.