Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. vectors

vectors

Scheduled Pinned Locked Moved C#
graphicshelp
18 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aavakas
    wrote on last edited by
    #1

    Can someone help me with this: vector length is 20 and starts from 0 to 20 it have to be like this 0,2,4,6,8,10,12,14,16,18,20

    D A D P 6 Replies Last reply
    0
    • A aavakas

      Can someone help me with this: vector length is 20 and starts from 0 to 20 it have to be like this 0,2,4,6,8,10,12,14,16,18,20

      D Offline
      D Offline
      Dan Neely
      wrote on last edited by
      #2

      See here.[^]

      -- Rules of thumb should not be taken for the whole hand.

      D 1 Reply Last reply
      0
      • A aavakas

        Can someone help me with this: vector length is 20 and starts from 0 to 20 it have to be like this 0,2,4,6,8,10,12,14,16,18,20

        D Offline
        D Offline
        Drew McGhie
        wrote on last edited by
        #3

        Hi! Welcome to code project. Since this was your first post, let me remind you of something that you may have glossed over when setting up your account and making your first post. Firstly, we don't do work for you. Well, unless you're going to pay us. CP is a community of people who help each other through issues, and learn from each other's mistakes/trials/succeesses. Is this homework? Seems like it, especially with a problem that simple. Are you looking for the specific object to use to hold that collection of numbers, or why one collection might be better than another? Are you looking for advice on the methods to generate that sequence, whether to use a foreach statement, for loop, while loop, or do while loop? We'll probably be able to give you advice on your case as well. What have you tried so far? Tell us what hasn't worked, and we'll give you advice on how to make it work, or other things to try that might work better.

        1 Reply Last reply
        0
        • A aavakas

          Can someone help me with this: vector length is 20 and starts from 0 to 20 it have to be like this 0,2,4,6,8,10,12,14,16,18,20

          A Offline
          A Offline
          aavakas
          wrote on last edited by
          #4

          but can u tell me then is there somthing right and why it does not end with 20 #include int main() { int a ,i[20]; a=20; for (i=0; i

          E 1 Reply Last reply
          0
          • A aavakas

            Can someone help me with this: vector length is 20 and starts from 0 to 20 it have to be like this 0,2,4,6,8,10,12,14,16,18,20

            A Offline
            A Offline
            aavakas
            wrote on last edited by
            #5

            i want do know why this program doesnt end can u give me advise `?

            D C 2 Replies Last reply
            0
            • D Dan Neely

              See here.[^]

              -- Rules of thumb should not be taken for the whole hand.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Good find! I'll just save that one in my Favorites. :-D

              Dave Kreskowiak Microsoft MVP - Visual Basic

              D 1 Reply Last reply
              0
              • A aavakas

                i want do know why this program doesnt end can u give me advise `?

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                First, this is the C# forum, not the C or C++. There are seperate forums for them. Next, it doesn't end because of your for statement. THere is something very wrong with the end of that line. What's wrong with the bolded part and what is that clause, as you've written it, actually doing?

                for (i-0; i<a; i=+2)

                Dave Kreskowiak Microsoft MVP - Visual Basic

                1 Reply Last reply
                0
                • D Dave Kreskowiak

                  Good find! I'll just save that one in my Favorites. :-D

                  Dave Kreskowiak Microsoft MVP - Visual Basic

                  D Offline
                  D Offline
                  Dan Neely
                  wrote on last edited by
                  #8

                  Enjoy, I've been using it on and off for a year or so. :D

                  -- Rules of thumb should not be taken for the whole hand.

                  1 Reply Last reply
                  0
                  • A aavakas

                    but can u tell me then is there somthing right and why it does not end with 20 #include int main() { int a ,i[20]; a=20; for (i=0; i

                    E Offline
                    E Offline
                    ednrgc
                    wrote on last edited by
                    #9

                    There are really many things wrong. #1: the for loop should be either i=i+2 or i+=2 #2: you're not assigning values to the array i #3: you're using i (which is an array) as the variable in the for loop.

                    C 1 Reply Last reply
                    0
                    • E ednrgc

                      There are really many things wrong. #1: the for loop should be either i=i+2 or i+=2 #2: you're not assigning values to the array i #3: you're using i (which is an array) as the variable in the for loop.

                      C Offline
                      C Offline
                      Christian Graus
                      wrote on last edited by
                      #10

                      You forgot one - it's C code, in a C# forum.

                      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                      E 1 Reply Last reply
                      0
                      • C Christian Graus

                        You forgot one - it's C code, in a C# forum.

                        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                        E Offline
                        E Offline
                        ednrgc
                        wrote on last edited by
                        #11

                        :-O

                        1 Reply Last reply
                        0
                        • A aavakas

                          i want do know why this program doesnt end can u give me advise `?

                          C Offline
                          C Offline
                          Christian Graus
                          wrote on last edited by
                          #12

                          I think you wanted +=, not =+. As someone said, you need to post in the right forum, this is C#. Also, your first port of call should be to set a break point in your program, then you can step through and see why it's behaving as it is. F9 sets a breakpoint, F5 starts debugging.

                          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                          D 1 Reply Last reply
                          0
                          • A aavakas

                            Can someone help me with this: vector length is 20 and starts from 0 to 20 it have to be like this 0,2,4,6,8,10,12,14,16,18,20

                            A Offline
                            A Offline
                            aavakas
                            wrote on last edited by
                            #13

                            thank u all , it works now

                            1 Reply Last reply
                            0
                            • C Christian Graus

                              I think you wanted +=, not =+. As someone said, you need to post in the right forum, this is C#. Also, your first port of call should be to set a break point in your program, then you can step through and see why it's behaving as it is. F9 sets a breakpoint, F5 starts debugging.

                              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                              D Offline
                              D Offline
                              Dave Kreskowiak
                              wrote on last edited by
                              #14

                              Christian Graus wrote:

                              I think you wanted +=, not =+.

                              Damn it man, don't give him the answer! :-D It was so simple to fix, I left it as an excersize for him. I just pointed him at where the problem was...

                              Dave Kreskowiak Microsoft MVP - Visual Basic

                              C 1 Reply Last reply
                              0
                              • A aavakas

                                Can someone help me with this: vector length is 20 and starts from 0 to 20 it have to be like this 0,2,4,6,8,10,12,14,16,18,20

                                P Offline
                                P Offline
                                Professor Sharada Ulhas
                                wrote on last edited by
                                #15

                                aavak! This is ur Professor Ulhas, from university. when I gived out the ass ignments for homeworks and maths i tell you never to post it on the CPians internet pages. but here i find you posting it. :(( u make me love hating you for your cheatings!!!! :(( :(( when you get back to class tomorrow I will have to give you blackened grade and corporal punishment with many dire consexuences. i must also summon the winter solstice gods on your eternally damned soul for ur cheatings. even teh baby jesus hates u.

                                Sincelery yours, Computer Information conSciences Professor and grader, Sharada Ulhas

                                F 1 Reply Last reply
                                0
                                • D Dave Kreskowiak

                                  Christian Graus wrote:

                                  I think you wanted +=, not =+.

                                  Damn it man, don't give him the answer! :-D It was so simple to fix, I left it as an excersize for him. I just pointed him at where the problem was...

                                  Dave Kreskowiak Microsoft MVP - Visual Basic

                                  C Offline
                                  C Offline
                                  Christian Graus
                                  wrote on last edited by
                                  #16

                                  *grin* sorry, I missed that one.  I replied mostly to point out the debugger option.

                                  Christian Graus - C++ MVP 'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert

                                  1 Reply Last reply
                                  0
                                  • P Professor Sharada Ulhas

                                    aavak! This is ur Professor Ulhas, from university. when I gived out the ass ignments for homeworks and maths i tell you never to post it on the CPians internet pages. but here i find you posting it. :(( u make me love hating you for your cheatings!!!! :(( :(( when you get back to class tomorrow I will have to give you blackened grade and corporal punishment with many dire consexuences. i must also summon the winter solstice gods on your eternally damned soul for ur cheatings. even teh baby jesus hates u.

                                    Sincelery yours, Computer Information conSciences Professor and grader, Sharada Ulhas

                                    F Offline
                                    F Offline
                                    Frank Kerrigan
                                    wrote on last edited by
                                    #17

                                    I take it you don't teach English grammer :-D He's a very naughty boy :|


                                    Blog Have I http:\\www.frankkerrigan.com

                                    P 1 Reply Last reply
                                    0
                                    • F Frank Kerrigan

                                      I take it you don't teach English grammer :-D He's a very naughty boy :|


                                      Blog Have I http:\\www.frankkerrigan.com

                                      P Offline
                                      P Offline
                                      Professor Sharada Ulhas
                                      wrote on last edited by
                                      #18

                                      mr kerrigan you inslut the good and freindly professor ulhas? do you want, are you asking, for summoning of cursings of shiva on you?! :(( i hope not so. maybe you bring the cheatingers on cpian internetp ages with u consexquences. :((

                                      Sincelery yours, Computer Information conSciences Professor and grader, Sharada Ulhas

                                      1 Reply Last reply
                                      0
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes


                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • World
                                      • Users
                                      • Groups