Author

Topic: I need some C# help (Read 734 times)

legendary
Activity: 1540
Merit: 1000
May 05, 2015, 11:08:53 AM
#14
Be sure to get this book if you're serious about programming: http://www.amazon.com/Primer-5th-Edition-Stanley-Lippman/dp/0321714113

Even though it's C++ it's got tons of information and glossaries about all the programming vocubulary etc. you need and there are free .pdfs around on the internet if you really want it. I particularly recommend this one just because it explains all sorts of terms to you in actual English so you can have a conversation with other programmers and not feel completely lost.
legendary
Activity: 1456
Merit: 1000
April 28, 2015, 06:10:14 PM
#13
One thing I might suggest is comparing code to what instructor used.   In programming there are ton's of ways to solve a solution.  But if everyone uses about the same code shown in class and you use different it will bring up questions.

Also are you allowed to use laptops during class?   If you are I suggest bringing one and trying to write the programs as instructor does.   That helped me alot then I had a version to compare to.
legendary
Activity: 1344
Merit: 1023
Mine at Jonny's Pool
April 28, 2015, 05:27:17 PM
#12
@jonnybravo0311, you helped me a lot. Thanks

We have 2 hours of informatics weekly. Professor tells us to write some material from the books in our notebooks and when we are done, we are free.

OK, I have done it with numbers.
http://img.prntscr.com/img?url=https://i.imgur.com/xtFIDIX.png

Can you give me some hint how to do it with text?
 
http://img.prntscr.com/img?url=https://i.imgur.com/zuLSoPJ.png
The text one will be very similar.  Instead of printing out your counter variable, you just print the text over and over again.

Code:
int i = 0;
do {
  Console.WriteLine("jonnybravo0311");
  i++;
}
while (i < 10);

You'll have to explain the third task a bit more clearly.  Are you supposed to prompt the user to actually tell you whether to show odds or evens?  Or are you just supposed to count to 100 by odds first, and evens second?

Think about that third task and try to put it into terms like I did for your first task.  How do you count only the odds, or only the evens in your head?  How would you do it on paper?
legendary
Activity: 2786
Merit: 1031
April 28, 2015, 05:04:20 PM
#11

1. task
Program which writes my name 10 times.

#include

main()

{

  int n;
  n=10;
  While (n)

    {
     printf (Your Name);
     n = n-1;
    }

}

LOL! This is a C program and not C#.

Oh, I see, I didn't even knew this exists, it's the Microsoft spin-off of C...

Sorry for wasting my time. Smiley
hero member
Activity: 924
Merit: 1003
4 Mana 7/7
April 28, 2015, 04:56:37 PM
#10
I forgot to mention. We need to use do while loop.
legendary
Activity: 2632
Merit: 1094
April 28, 2015, 04:49:55 PM
#9
@jonnybravo0311, you helped me a lot. Thanks

We have 2 hours of informatics weekly. Professor tells us to write some material from the books in our notebooks and when we are done, we are free.

OK, I have done it with numbers.


Can you give me some hint how to do it with text?
 


Use a for loop instead of a do and while loop.:

for (; ; )
         {
            Console.WriteLine("Your name");
         }



1. task
Program which writes my name 10 times.

#include

main()

{

  int n;
  n=10;
  While (n)

    {
     printf (Your Name);
     n = n-1;
    }

}

LOL! This is a C program and not C#.
legendary
Activity: 2786
Merit: 1031
April 28, 2015, 04:47:54 PM
#8

1. task
Program which writes my name 10 times.

#include

main()

{

  int n;
  n=10;
  While (n)

    {
     printf (Your Name);
     n = n-1;
    }

}
hero member
Activity: 924
Merit: 1003
4 Mana 7/7
April 28, 2015, 04:38:49 PM
#7
@jonnybravo0311, you helped me a lot. Thanks

We have 2 hours of informatics weekly. Professor tells us to write some material from the books in our notebooks and when we are done, we are free.


I highly suggest buying a new book if that one is not good.  Not all books are equal on teaching programming. 

I suggest looking at Amazon.  There are some great books, that will make learning much easier if your book is crappy.
OK. I think I will do it, because I have done same thing with excel.
Thanks.
legendary
Activity: 1456
Merit: 1000
April 28, 2015, 04:36:07 PM
#6
@jonnybravo0311, you helped me a lot. Thanks

We have 2 hours of informatics weekly. Professor tells us to write some material from the books in our notebooks and when we are done, we are free.


I highly suggest buying a new book if that one is not good.  Not all books are equal on teaching programming. 

I suggest looking at Amazon.  There are some great books, that will make learning much easier if your book is crappy.
legendary
Activity: 1344
Merit: 1023
Mine at Jonny's Pool
April 28, 2015, 03:17:00 PM
#5
Hi guys,

I started learning programming in school and I got some tasks for my homework.
I solved the easier tasks, but I can't solve "harder" ones.
I hope you will give me some instructions.

Thanks Smiley

1. task
Program which writes my name 10 times.

2. task
Program which writes numbers 1-10

3. task
Program which writes numbers 0-100 and only shows even or odd numbers.
Each of these exercises requires you to understand looping constructs.  The first one asks you to repeat a task 10 times.  The second asks you to count to 10 and the third asks you to ... well, I think you wrote the third one down wrong because showing only even or odd numbers will show them all Smiley - unless you're supposed to prompt the user to enter whether or not he wishes to see evens or odds?  That seems a bit more complicated than the other two which are simply asking you to understand loops.

Loops in programming are very similar to how you'd think of repetitive tasks in your life.  For example, let's look at the first task.  How would you do it on paper (without using computer code)?

1) Look to see how many times your name has been written
2) If your name has been written fewer than 10 times, write your name
3) Repeat

You could also express this as a sentence:

I will repeatedly write my name until I have written it 10 times.

By doing this, you have given yourself a task that must be repeated until a condition is met.  Let's think of that sentence in another way:

While I have written my name fewer than 10 times, write my name.

So... you need a way to count how many times you've written your name, a way to write your name, a way to increment your counter, and a way to repeat those tasks.

We would start our counter at 0 because you haven't written your name yet.  Now, you start your repeating loop.  Is the counter less than 10?  If yes, write your name and increment the counter.  Do it again.  Now the counter is 1.  Is that less than 10?  Yup.  Write your name and increment the counter.

Now let's think of it in terms of code:

Initialize counter to 0.
While counter is less than 10:
 * Write my name
 * increment counter

I hope this helps, and allows you to follow along with your other 2 tasks.
hero member
Activity: 924
Merit: 1003
4 Mana 7/7
April 28, 2015, 02:56:10 PM
#4
You want us to do your homework?  Seriously? You made me laugh hard.

On a serious note look at your book, or online all of those are easily done.  You are starting off easy in C#.  If you don't understand the basics like this at end of semester you will be hurting very bad on keeping up.   Each lesson in programming builds on one before it.
I didn't ask you to do my homework. I don't want you to do it for me. I asked for instructions only
full member
Activity: 193
Merit: 100
April 28, 2015, 02:51:08 PM
#3
you need help in c? are you serious ?

Quote
1. task
Program which writes my name 10 times.

use loop . while loop preferred . sorry i will tell you other ones later i m on mobile at the moment if you say i can write whole programs for all of them Smiley

legendary
Activity: 1456
Merit: 1000
April 28, 2015, 02:50:38 PM
#2
You want us to do your homework?  Seriously? You made me laugh hard.

On a serious note look at your book, or online all of those are easily done.  You are starting off easy in C#.  If you don't understand the basics like this at end of semester you will be hurting very bad on keeping up.   Each lesson in programming builds on one before it.
hero member
Activity: 924
Merit: 1003
4 Mana 7/7
April 28, 2015, 02:43:51 PM
#1
Hi guys,

I started learning programming in school and I got some tasks for my homework.
I solved the easier tasks, but I can't solve "harder" ones.
I hope you will give me some instructions.

Thanks Smiley

1. task
Program which writes my name 10 times.

2. task
Program which writes numbers 1-10

3. task
Program which writes numbers 0-100 and only shows even or odd numbers.
Jump to: