Jump to content

Recommended Posts

Posted

εάν δεν το κάνεις μόνος σου δεν έχει αξία , και επίσης δεν βλέπω κάτι το δύσκολο στον κώδικα εκτός από το 1) που δεν έχω ιδέα για το πως γίνεται ... ( επίσης δεν έχω ιδέα από c# αλλά από την ΓΛΩΣΣΑ που κάνουμε σχολείο μπορώ να κάνω ένα πρόγραμμα με τα 2-3 )

Posted

εάν δεν το κάνεις μόνος σου δεν έχει αξία , και επίσης δεν βλέπω κάτι το δύσκολο στον κώδικα εκτός από το 1) που δεν έχω ιδέα για το πως γίνεται ... ( επίσης δεν έχω ιδέα από c# αλλά από την ΓΛΩΣΣΑ που κάνουμε σχολείο μπορώ να κάνω ένα πρόγραμμα με τα 2-3 )

thelei code se Visual C#
Posted

 

Ekana To 1o Erwtima:

using System;

class Lab1Ex1

{

    public static void Main()

    {

 

 

        Console.WriteLine("Username:");

        string username = Console.ReadLine();

        Console.WriteLine("Password:");

        string password = Console.ReadLine();

       

 

        if (username == "admin" && password == "admin")

        {

            Console.WriteLine("You are now logged !!!");

        }

             

        else

        {

            Console.WriteLine("Invalid Username Or Password !!!");

        }

            Console.ReadKey(); 

        }

    }

 

===========================================

Dn mporw na valw orio gia 3 prospathies.....pws ginete auto ??? 

     

Posted

Dn mporw na valw orio gia 3 prospathies.....pws ginete auto ??? 

     

ευκολα γινεται με ενα for ή while loop.

καντο με while καλυτερα , δημιουργησε μια μεταβλητη int που θα ειναι οι ευκαιριες.

μεσα στο while οποτε χρειαζεται θα αυξανεται κατα μια , φυσικα δε θα γινεται να χρησιμοποιησουν αλλες λειτουργιες αν δεν εχουν αλλη ευκαιρια.

 

while(eukeries < 3)

{

//blabla

}

Posted

Και αυτό είναι project? Ω θεέ μου τι σκατά σας μαθαίνουν...

 

Τέσπα on the point:

 

Για το "μενού επιλογών" η λογική είναι να τρέξεις έναν ατέρμων βρόγχο (while (true) {}) και να εμφανίζεις τις επιλογές καθώς και να παίρνεις είσοδο από το χρήστη. Ανάλογα τι θα πατήσει καλείς και ένα συγκεκριμένο function που θα κάνει ό,τι ζητάει το κάθε ερώτημα. Μόλις τελειώσει το function, θα γυρίσει στο menu επιλογών (ο ατέρμων βρόγχος του while) και θα μπορεί ο άλλος να ξαναπατήσει ό,τι θέλει. Άμα πατήσει 0, κάνεις break από το βρόγχο και τερματίζεις το πρόγραμμά σου κανονικά. Όσο για τα υπόλοιπα ερωτήματα, είναι πολύ απλά και δεν απαιτούν πάνω από μισή ώρα γραψίματος.

 

Ελπίζω να βοήθησα...

Posted

using System;

class Lab1Ex1

{

public static void Main()

{

 

 

Console.WriteLine("Username:");

string username = Console.ReadLine();

Console.WriteLine("Password:");

string password = Console.ReadLine();

 

if (username == "admin" && password == "admin")

{

Console.WriteLine("You are now logged !!!\n");

{

{

 

Console.WriteLine("MiniProject C#\n");

 

Console.WriteLine("1 - Ypologismos Ginomenou");

Console.WriteLine("2 - Megistos Koinos Diairetis");

Console.WriteLine("3 - 3psifioi Arithmoi Harshad");

Console.WriteLine("0 - Exit\n");

 

Console.Write("Epiloges (1,2,3,or 0): ");

 

 

}

string menu;

menu = Console.ReadLine();

switch (menu)

{

case "1":

Console.WriteLine("1o Erwmima.");

break;

case "2":

Console.WriteLine("2o erwtima.");

break;

case "3":

Console.WriteLine("3o erwtima.");

break;

case "0":

Console.WriteLine("Bye.");

break;

default:

Console.WriteLine("Lathos Epilogi!!!", menu);

break;

}

}

}

else

{

Console.WriteLine("Invalid Username Or Password !!!");

}

Console.ReadKey();

}

}

====================================================================================

Δεν μπορώ να βάλω την επανάληψη [do while (menu != "0" && menu != "0");] ώστε να γυρίζει συνέχεια στο μενού μεχρι ο χρηστης να πατήσει το 0....

Posted

using System;

class Lab1Ex1

{

public static void Main()

{

 

 

Console.WriteLine("Username:");

string username = Console.ReadLine();

Console.WriteLine("Password:");

string password = Console.ReadLine();

 

if (username == "admin" && password == "admin")

{

Console.WriteLine("You are now logged !!!\n");

{

{

 

Console.WriteLine("MiniProject C#\n");

 

Console.WriteLine("1 - Ypologismos Ginomenou");

Console.WriteLine("2 - Megistos Koinos Diairetis");

Console.WriteLine("3 - 3psifioi Arithmoi Harshad");

Console.WriteLine("0 - Exit\n");

 

Console.Write("Epiloges (1,2,3,or 0): ");

 

 

}

string menu;

menu = Console.ReadLine();

switch (menu)

{

case "1":

Console.WriteLine("1o Erwmima.");

break;

case "2":

Console.WriteLine("2o erwtima.");

break;

case "3":

Console.WriteLine("3o erwtima.");

break;

case "0":

Console.WriteLine("Bye.");

break;

default:

Console.WriteLine("Lathos Epilogi!!!", menu);

break;

}

}

}

else

{

Console.WriteLine("Invalid Username Or Password !!!");

}

Console.ReadKey();

}

}

====================================================================================

Δεν μπορώ να βάλω την επανάληψη [do while (menu != "0" && menu != "0");] ώστε να γυρίζει συνέχεια στο μενού μεχρι ο χρηστης να πατήσει το 0....

 

Αυτό ακριβώς πρέπει να κάνεις. Δηλαδή...

 


Console.WriteLine("1 - Ypologismos Ginomenou");
Console.WriteLine("2 - Megistos Koinos Diairetis");
Console.WriteLine("3 - 3psifioi Arithmoi Harshad");
Console.WriteLine("0 - Exit\n");

Console.Write("Epiloges (1,2,3,or 0): ");

menu = Console.ReadLine();
while (menu != "0") { 
       
       // Χειρισμός των επιλογών όπως έχεις ήδη κάνει με switch ;)
    
       Console.WriteLine("1 - Ypologismos Ginomenou");
       Console.WriteLine("2 - Megistos Koinos Diairetis");
       Console.WriteLine("3 - 3psifioi Arithmoi Harshad");
       Console.WriteLine("0 - Exit\n");  

       Console.Write("Epiloges (1,2,3,or 0): ");

       menu = Console.ReadLine();
}

  • 3 weeks later...
Posted

κάτι πρόχειρο αλλά δουλεύει νομίζω

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            string[] args = new string[2];
            args[0] = "username";
            args[1] = "password";

            int fAttempts = 0;

            while (fAttempts <= 3)
            {
                Console.WriteLine("Username:");
                string username = Console.ReadLine();
                Console.WriteLine("Password:");
                string password = Console.ReadLine();
                if (username == args[0] && password == args[1])
                {
                    break; //exit while
                }
                else { fAttempts++; Console.WriteLine("Login failed invalid credentials!\n"); }
            }
            if (fAttempts == 3) { Console.WriteLine("Your login attempts limit has been reached, application will now exit!"); Console.ReadLine(); return; } //Exit

            int menu = 1;
                    
            while (menu != 0)
            {
                showMenu();
                menu = Convert.ToInt32(Console.ReadLine()); //ksanadiavazei

                if (menu == 1)
                {
                    Console.WriteLine("Dwse to M:");
                    int m = Convert.ToInt32(Console.ReadLine());

                    if (m>0)
                    {
                        int sum = 0;
                        int tSum = 0;

                        int i;
                        for (i = 0; i <= m; i++)
                        {
                            if (sum >= m) break;
                            sum = sum * 2 + 1; // ((0x2) + 1 ),(1x2)+1) klp klp
                            tSum += sum;
                           // Console.WriteLine(sum + "\n");
                        }
                        Console.WriteLine(tSum + "\n");
                    }
                }
                else if (menu == 2)
                {
                    Console.WriteLine("Dwse prwto akeraio:");
                    int a = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Dwse deutero akeraio:");
                    int b = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine(gcd(a, b));
                }
                else if (menu == 3)
                {
                    int i = 100;
                    for (i = 100; i <= 999; i++)
                    {
                        int f = (i / 100) % 10;
                        int s = (i / 10) % 10;
                        int t = i % 10;
                        int sum = f + s + t;
                        if (i % sum == 0) Console.WriteLine(i+",");
                    }
                    Console.WriteLine("\n");
                }
                else if (menu == 0)
                {
                    Console.WriteLine("The application will not exit, you typed 0!");
                    Console.ReadLine();
                    return;
                }
            }

        }

        static int gcd(int u, int v)
               {
                // simple cases (termination)
                 if (u == v)
                 return u;
                if (u == 0)
                 return v;
                if (v == 0)
                 return u;

              // look for factors of 2
                if (u%2==0) // u is even
                if (v%2==1) // v is odd
                return gcd(u >> 1, v);
                else // both u and v are even
                return gcd(u >> 1, v >> 1) << 1;
                if (v%2==0) // u is odd, v is even
                return gcd(u, v >> 1);

                // reduce larger argument
                if (u > v)
                return gcd((u - v) >> 1, v);
                return gcd((v - u) >> 1, u);
                }

        static void showMenu()
        {
            Console.WriteLine("MiniProject C#\n");

            Console.WriteLine("1 - Ypologismos Ginomenou");
            Console.WriteLine("2 - Megistos Koinos Diairetis");
            Console.WriteLine("3 - 3psifioi Arithmoi Harshad");
            Console.WriteLine("0 - Exit\n");

            Console.Write("Epiloges (1,2,3,or 0): ");
        }
    }
}

 

se VS 2008

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • New user panel SOURCE $ 200 for source code. R$ 1000,00 BRL for source code.    
    • Hello everyone, we are one of the top gaming currency stores. We work exclusively with top projects. If you are interested in anything like Adena, Coins, Equip, write to us Discord - pchelacoin Telegram - https://t.me/ipchelacoin BOHPTS, KETRAWARS, EURO-PVP, L2REBORN, E-GLOBAL, LA2DREAM TOP PRICE !!!!!!!
    • L2Elixir – Patch 4 Is Live!   We’re working non-stop, day and night, to deliver the best possible quality and bring back what made L2Elixir special. This project is built with passion, not shortcuts — for the old-school players who remember, and the new ones who want to experience it properly. Thank you for being part of the journey. Together, we’re making L2Elixir great again ❤️ The legends never fade.    ⚙️ General Enabled Class Change service (same class type only) ALT + B → Services → Character Development Enabled Shift + Click on Treasure Chests Players can now identify real chests (Adena, scroll drops) and use Key / Unlock Event deaths now cancel only debuffs, All self buffs are preserved, fixes issues with Root and similar effects Bladedancer class can now log in even when Max Clients (2) is reached. Since an active Bladedancer is not available for every damage dealer and some players tried to abuse this via VPN or a second PC, this feature was added to keep things fair. protections applies, requires testing!    🎒 Items Crystallizing enchanted items now gives the correct increased crystal amount (retail-like behavior) Removed Agathion Seal Bracelet: Rudolph from Santa rewards (Gracia Final item) Added Dualsword Craft Stamp into Milestone Exchange list    🧙 Skills Fixed Banish Undead lethal chance Hot Springs Malaria and similar effects now level up faster while being attacked
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock