Keep getting erron messege, not sure how to fix it!

This is a discussion on Keep getting erron messege, not sure how to fix it! within the C++ Programming forums, part of the General Programming Boards category; I am new to C++ and I am writing a program that will create 100 random numbers and split them ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    6

    Unhappy Keep getting erron messege, not sure how to fix it!

    I am new to C++ and I am writing a program that will create 100 random numbers and split them by odd and even. I think I have the code correct but I keep getting this error:

    error C2440: '=' : cannot convert from 'void' to 'int'

    The error is for the line sum = srand(i)
    Here is the program:

    Code:
    #include <iostream>
    using namespace std;
    void main()
    {
    int i, num, even, odd;  
    
    for(i = 0; i < 100; i++)
    {
    num = srand(i);
    }
    
    if ( num % 2 == 0 )
    even = num;
    else;
    odd = num;
    }
    // main

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,424
    duplicate post
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Keep getting erron messege, not sure how to fix it!
    By jessieo387 in forum C++ Programming
    Replies: 4
    Last Post: 03-20-2010, 06:48 PM
  2. Replies: 6
    Last Post: 12-06-2009, 05:09 AM
  3. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  4. C++ code need help to fix
    By McReal in forum C++ Programming
    Replies: 9
    Last Post: 05-12-2007, 02:48 PM
  5. Help me fix my mess!!!!
    By Starr in forum C++ Programming
    Replies: 35
    Last Post: 02-01-2006, 02:40 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21