Click here to Skip to main content
15,891,529 members
Home / Discussions / C#
   

C#

 
GeneralRe: Socket Programming Pin
Septimus Hedgehog3-Jun-13 2:01
Septimus Hedgehog3-Jun-13 2:01 
GeneralRe: Socket Programming Pin
Pete O'Hanlon3-Jun-13 2:27
mvePete O'Hanlon3-Jun-13 2:27 
GeneralRe: Socket Programming Pin
Septimus Hedgehog3-Jun-13 3:20
Septimus Hedgehog3-Jun-13 3:20 
AnswerRe: Socket Programming Pin
Septimus Hedgehog3-Jun-13 3:22
Septimus Hedgehog3-Jun-13 3:22 
QuestionC# Fill comboBox with DB content Pin
tizziCerutti2-Jun-13 1:45
tizziCerutti2-Jun-13 1:45 
AnswerRe: C# Fill comboBox with DB content Pin
Boipelo2-Jun-13 2:20
Boipelo2-Jun-13 2:20 
AnswerRe: C# Fill comboBox with DB content Pin
Anna King3-Jun-13 2:47
professionalAnna King3-Jun-13 2:47 
AnswerRe: C# Fill comboBox with DB content Pin
BobJanova3-Jun-13 4:12
BobJanova3-Jun-13 4:12 
GeneralRe: C# Fill comboBox with DB content Pin
tizziCerutti10-Jun-13 21:55
tizziCerutti10-Jun-13 21:55 
AnswerRe: C# Fill comboBox with DB content Pin
Amol_B4-Jun-13 19:41
professionalAmol_B4-Jun-13 19:41 
Question[Solved] Binding to data that will be resloved asyncronously Pin
AlphaDeltaTheta1-Jun-13 3:18
AlphaDeltaTheta1-Jun-13 3:18 
AnswerRe: Binding to data that will be resloved asyncronously Pin
Abhinav S1-Jun-13 7:35
Abhinav S1-Jun-13 7:35 
GeneralRe: Binding to data that will be resloved asyncronously Pin
AlphaDeltaTheta1-Jun-13 15:22
AlphaDeltaTheta1-Jun-13 15:22 
AnswerRe: Binding to data that will be resloved asyncronously Pin
Anna King3-Jun-13 2:55
professionalAnna King3-Jun-13 2:55 
AnswerRe: Binding to data that will be resloved asyncronously Pin
BobJanova3-Jun-13 4:14
BobJanova3-Jun-13 4:14 
GeneralRe: Binding to data that will be resloved asyncronously Pin
AlphaDeltaTheta3-Jun-13 17:15
AlphaDeltaTheta3-Jun-13 17:15 
QuestionC# Project On Image Processing Pin
Bishwajit Nepali31-May-13 23:47
Bishwajit Nepali31-May-13 23:47 
AnswerRe: C# Project On Image Processing Pin
Eddy Vluggen1-Jun-13 11:05
professionalEddy Vluggen1-Jun-13 11:05 
GeneralRe: C# Project On Image Processing Pin
Bishwajit Nepali24-Sep-13 8:29
Bishwajit Nepali24-Sep-13 8:29 
AnswerRe: C# Project On Image Processing Pin
Anna King3-Jun-13 3:00
professionalAnna King3-Jun-13 3:00 
AnswerRe: C# Project On Image Processing Pin
Pete O'Hanlon3-Jun-13 3:23
mvePete O'Hanlon3-Jun-13 3:23 
AnswerRe: C# Project On Image Processing Pin
Bishwajit Nepali3-Jun-13 6:12
Bishwajit Nepali3-Jun-13 6:12 
GeneralPracticing Passing Parameters Pin
N8tiv31-May-13 16:25
N8tiv31-May-13 16:25 
Drill 4-4
Rewrite the program created for Drill 4-2 to read the number and the
power as program arguments.

This first set of code is what I wrote for Drill 4-2.

The second set of code is what I'm attempting to write.

I've read all the articles at MSDN and even watched a few YouTube videos to try to find out where I'm going wrong.

I know it's probably something very elementary, but… My blue-collar butt is having a little hard time trying to figure out this white color stuff. Poke tongue | ;-P

Instead of actually writing and giving me the code, give me written instructions… So I could practice with written instructions as well.

Don't give me a link to another article, I've read as many as I could in the past few days trying to figure it out.
I'm just not quite thinking like a programmer yet. I need some practice in taking the written instructions.

I imagine the book I'm reading will eventually talk about the "public, void, private, partial, static" keyword sooner or later.
I'm not taking any formal classes, I'm trying to learn this on my own time. That's why I'm asking for written instructions so I can get a better grasp on how to use this language in the right context.

I have two blue squiggly lines in my main method for the integer variables.
Error message:
use of unassigned local variable 'num' and 'num1'





C#
using System;

namespace CalculatetothePowerof
{
    class Program
    {
        static void Main2()
        {
            int valOne = AcceptValue("Enter your first number:");
            int valTwo = AcceptValue("\nEnter your second number:");
            Console.WriteLine(Math.Pow(valOne, valTwo));
            Console.Read();
        }
        static int AcceptValue(string message)
        {
            string valueOne;
            int IntOne;
            string YesNo;
            do
            {
                Console.WriteLine(message);
                valueOne = Console.ReadLine();
                IntOne = Convert.ToInt32(valueOne);
                Console.WriteLine("Are you sure you want to use that number?\nPress lowercase y or n, to continue.");
                YesNo = Console.ReadLine();
                if (YesNo == "y")
                {
                    break;
                }
                Console.Clear();
            } while (YesNo != "y");
            return IntOne;
        }
    }
}


C#
using System;
using System.Text;

namespace MainMethodAcceptTwoArgValues
{
    class Program
    {
        static void Main()
        {
            int num;
            int num1;
            UserInput(num);
            UserInput(num1);
            Console.WriteLine(Math.Pow(num, num1));
        }
        static void UserInput(int input)
        {
            string userinput;
            string yes_no;
            do
            {
                Console.WriteLine("Enter your number: ");
                userinput = Console.ReadLine();
                Console.WriteLine("Correct numbers?\nPress y/n");
                yes_no = Console.ReadLine();
                if (yes_no == "y")
                {
                    input = Convert.ToInt32(userinput);
                    break;
                }
                Console.Clear();
            } while (yes_no != "y");
        }
    }
}


GeneralRe: Practicing Passing Parameters Pin
OriginalGriff31-May-13 21:15
mveOriginalGriff31-May-13 21:15 
GeneralRe: Practicing Passing Parameters Pin
N8tiv3-Jun-13 7:19
N8tiv3-Jun-13 7:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.