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

C#

 
AnswerRe: ordered list as in python Pin
BillWoodruff27-Dec-13 4:04
professionalBillWoodruff27-Dec-13 4:04 
GeneralRe: ordered list as in python Pin
gianfrancoguzzo27-Dec-13 4:17
gianfrancoguzzo27-Dec-13 4:17 
GeneralRe: ordered list as in python Pin
BillWoodruff27-Dec-13 11:32
professionalBillWoodruff27-Dec-13 11:32 
GeneralRe: ordered list as in python Pin
gianfrancoguzzo27-Dec-13 15:06
gianfrancoguzzo27-Dec-13 15:06 
GeneralRe: ordered list as in python Pin
gianfrancoguzzo29-Dec-13 2:00
gianfrancoguzzo29-Dec-13 2:00 
QuestionConsole.WriteLine properties of something Pin
Dick Lasy27-Dec-13 2:06
Dick Lasy27-Dec-13 2:06 
AnswerRe: Console.WriteLine properties of something Pin
Richard MacCutchan27-Dec-13 3:38
mveRichard MacCutchan27-Dec-13 3:38 
AnswerRe: Console.WriteLine properties of something Pin
BillWoodruff27-Dec-13 3:39
professionalBillWoodruff27-Dec-13 3:39 
There are several errors in the code in your Main method:

1. you don't convert the user-entered values for length, and width, from string to integer, and assign them to the variables 'l and 'b in the instance of the Class 'Rechteck.

2. you left out the required + string concatenation operator in the three lines that call your functions to calculate diagonal, perimeter, and area.

3. you call the functions to calculate diagonal, perimeter, and area with arguments when the functions have no parmeters.

Try this:
C#
static void Main(string[] args)
{
    Console.WriteLine("Gib die Länge vom Rechteck: ");
    string l = Console.ReadLine();

    Console.WriteLine("Gib die Breite vom Rechteck: ");
    string b = Console.ReadLine();

    Rechteck obj = new Rechteck();
    // changed
    obj.laenge = Convert.ToInt32(l);
    obj.breite = Convert.ToInt32(b);

    Console.WriteLine("Rechteck Länge: " + l + "\nRechteck Breite: " + b);
    // changed
    Console.WriteLine("Die Diagonale beträgt: " + obj.getDiagonale());
    Console.WriteLine("Der Umfang beträgt: " + obj.getUmfang());
    Console.WriteLine("Die Fläche beträgt: " + obj.getFlache());

    // added code
    // keep the Console on screen
    Console.ReadLine();
}

“I'm an artist: it's self evident that word implies looking for something all the time without ever finding it in full. It is the opposite of saying : 'I know all about it. I've already found it.'

As far as I'm concerned, the word means: 'I am looking. I am hunting for it. I am deeply involved.'”

Vincent Van Gogh

AnswerRe: Console.WriteLine properties of something Pin
Vinay Jade27-Dec-13 4:39
professionalVinay Jade27-Dec-13 4:39 
GeneralRe: Console.WriteLine properties of something Pin
Dick Lasy27-Dec-13 4:49
Dick Lasy27-Dec-13 4:49 
GeneralRe: Console.WriteLine properties of something Pin
Dick Lasy27-Dec-13 23:36
Dick Lasy27-Dec-13 23:36 
QuestionGenerate hyperlink to file Pin
piet kouwer26-Dec-13 21:06
piet kouwer26-Dec-13 21:06 
AnswerRe: Generate hyperlink to file Pin
Richard MacCutchan26-Dec-13 22:33
mveRichard MacCutchan26-Dec-13 22:33 
GeneralRe: Generate hyperlink to file Pin
piet kouwer26-Dec-13 22:41
piet kouwer26-Dec-13 22:41 
GeneralRe: Generate hyperlink to file Pin
Richard MacCutchan26-Dec-13 23:17
mveRichard MacCutchan26-Dec-13 23:17 
GeneralRe: Generate hyperlink to file Pin
piet kouwer27-Dec-13 0:07
piet kouwer27-Dec-13 0:07 
GeneralRe: Generate hyperlink to file Pin
Richard MacCutchan27-Dec-13 0:10
mveRichard MacCutchan27-Dec-13 0:10 
GeneralRe: Generate hyperlink to file Pin
piet kouwer27-Dec-13 0:27
piet kouwer27-Dec-13 0:27 
GeneralRe: Generate hyperlink to file Pin
Richard MacCutchan27-Dec-13 0:33
mveRichard MacCutchan27-Dec-13 0:33 
GeneralRe: Generate hyperlink to file Pin
Richard MacCutchan27-Dec-13 0:22
mveRichard MacCutchan27-Dec-13 0:22 
GeneralRe: Generate hyperlink to file Pin
piet kouwer27-Dec-13 0:32
piet kouwer27-Dec-13 0:32 
AnswerRe: Generate hyperlink to file Pin
Ron Nicholson27-Dec-13 3:46
professionalRon Nicholson27-Dec-13 3:46 
QuestionConvert BitmapImage into byte arrays in wpf Pin
Member 1001614026-Dec-13 11:42
Member 1001614026-Dec-13 11:42 
AnswerRe: Convert BitmapImage into byte arrays in wpf Pin
OriginalGriff26-Dec-13 21:04
mveOriginalGriff26-Dec-13 21:04 
GeneralRe: Convert BitmapImage into byte arrays in wpf Pin
Member 1001614027-Dec-13 0:24
Member 1001614027-Dec-13 0:24 

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.