daonlyillwiz's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
142 (0.18 per day)
Joined:
14-March 11
Profile Views:
450
Last Active:
User is offline Apr 30 2013 07:10 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   daonlyillwiz has not set their status

Posts I've Made

  1. In Topic: Alternating sum problem with vector addition

    Posted 30 Apr 2013

    View PostZereo, on 30 April 2013 - 06:58 AM, said:

    Another way to solve it would be to use a single for loop that loops through the elements in the vector and then a if condition in the loop that tests whether the index is even or odd.

    Hint: To test even and odd use the modulus operator %



    I was using the modulus op % but my stupid self used an if/else instead of a loop...thanks again Zereo :)
  2. In Topic: Alternating sum problem with vector addition

    Posted 30 Apr 2013

    	//alternating sum 
    	for (int i=0;i<v.size();i+=2)
    		altsumEven+=v[i];
    	for (int i=1;i<v.size();i+=2)
    		altsumOdd+=v[i];
    
    	altsum=altsumEven-altsumOdd;						// takes sum of all even positions and subtracts by sum of all odd positions in the vector
    



    Got it thanks alot :)
  3. In Topic: Finding min and max int in an array

    Posted 14 Mar 2013

    Ohh so that's why haha
  4. In Topic: Finding min and max int in an array

    Posted 14 Mar 2013

    Yes did you not read my last comment. I knew the answer but it wasn't working and it was because I was forgetting a semicolon after [n-1] for the last element in the array...

    I apologize, turns out my comment didn't post for some reason but I figured it out a long time ago, was a stupid mistake.
  5. In Topic: Finding min and max int in an array

    Posted 14 Mar 2013

    I can do that for the first element of the array, but how to do it for the last ?

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

daonlyillwiz hasn't added any friends yet.

Comments

daonlyillwiz has no profile comments yet. Why not say hello?