Click here to Skip to main content
15,885,366 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Practicing Passing Parameters Pin
OriginalGriff3-Jun-13 7:59
mveOriginalGriff3-Jun-13 7:59 
GeneralRe: Practicing Passing Parameters Pin
Richard MacCutchan31-May-13 23:21
mveRichard MacCutchan31-May-13 23:21 
GeneralRe: Practicing Passing Parameters Pin
N8tiv3-Jun-13 1:02
N8tiv3-Jun-13 1:02 
GeneralRe: Practicing Passing Parameters Pin
Richard MacCutchan3-Jun-13 1:20
mveRichard MacCutchan3-Jun-13 1:20 
GeneralRe: Practicing Passing Parameters Pin
N8tiv3-Jun-13 2:39
N8tiv3-Jun-13 2:39 
GeneralRe: Practicing Passing Parameters Pin
Richard MacCutchan3-Jun-13 6:15
mveRichard MacCutchan3-Jun-13 6:15 
GeneralRe: Practicing Passing Parameters Pin
N8tiv3-Jun-13 21:01
N8tiv3-Jun-13 21:01 
GeneralRe: Practicing Passing Parameters Pin
Richard MacCutchan3-Jun-13 21:15
mveRichard MacCutchan3-Jun-13 21:15 
GeneralRe: Practicing Passing Parameters Pin
N8tiv3-Jun-13 3:46
N8tiv3-Jun-13 3:46 
GeneralRe: Practicing Passing Parameters Pin
Richard MacCutchan3-Jun-13 6:11
mveRichard MacCutchan3-Jun-13 6:11 
QuestionTo detect all USB devices. Pin
ravi inder jeet singh31-May-13 15:44
ravi inder jeet singh31-May-13 15:44 
AnswerRe: To detect all USB devices. Pin
Dave Kreskowiak1-Jun-13 6:51
mveDave Kreskowiak1-Jun-13 6:51 
QuestionSkype in C# Pin
Kevin Marois31-May-13 12:12
professionalKevin Marois31-May-13 12:12 
AnswerRe: Skype in C# Pin
Ron Beyer31-May-13 12:14
professionalRon Beyer31-May-13 12:14 
GeneralRe: Skype in C# Pin
Kevin Marois31-May-13 12:15
professionalKevin Marois31-May-13 12:15 

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.