Help in some errors!!!!!

This is a discussion on Help in some errors!!!!! within the C++ Programming forums, part of the General Programming Boards category; Code: 1>------ Build started: Project: h, Configuration: Debug Win32 ------ 1>Compiling... 1>h2.cpp 1>c:\users\alsaadi\documents\visual studio 2008\projects\h\h\h2.cpp(21) : warning C4244: 'argument' : ...

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    6

    Red face Help in some errors!!!!!

    Code:
    1>------ Build started: Project: h, Configuration: Debug Win32 ------
    1>Compiling...
    1>h2.cpp
    1>c:\users\alsaadi\documents\visual studio 2008\projects\h\h\h2.cpp(21) : warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
    1>c:\users\alsaadi\documents\visual studio 2008\projects\h\h\h2.cpp(33) : warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
    1>c:\users\alsaadi\documents\visual studio 2008\projects\h\h\h2.cpp(36) : error C2446: '==' : no conversion from 'int' to 'int *'
    1>        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    1>c:\users\alsaadi\documents\visual studio 2008\projects\h\h\h2.cpp(36) : error C2040: '==' : 'int [11]' differs in levels of indirection from 'int'
    1>Build log was saved at "file://c:\Users\ALSAADI\Documents\Visual Studio 2008\Projects\h\h\Debug\BuildLog.htm"
    1>h - 2 error(s), 2 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Last edited by AMA1989; 04-26-2011 at 05:44 AM.

  2. #2
    Registered User
    Join Date
    Apr 2011
    Posts
    6
    Code:
    This my programme:
    #include <iostream>
    #include <iomanip>
    #include <fstream>
    #include <ctime>
    #include <cstdlib> 
    using namespace std;
    
    
    int main ()
    {
    ofstream MyOutFile;
    	
    int sum1;
    int prod1;
    int sum2;
    int prod2;
    int sumR;
    int prodR;
    
    int A[11];
    int RandomNamber1; srand (time(0));
    RandomNamber1 = rand();
    if (A==0,2,4,6,8,10)
    
    sum1=0+2+4+6+8+10;
    
    else
    
    prod1=0*2*4*6*8*10;
    
    int B[11];
    int RandomNamber2;
    srand (time(0));
    RandomNamber2 = rand();
    
    if (A==1,3,5,7,9,11)
    
    sum2=1+3+5+7+9+11;
    
    else
    
    prod2=1*3*5*7*9*11;
    
    
    int Result[11];
    
    sumR=sum1+sum2;
    prodR=prod1*prod2;
    
    
    
    MyOutFile.open ("MyData.txt");
    int OF;
    MyOutFile << endl;
    MyOutFile <<"------------------------------------------";
    MyOutFile << "Array 1:" << setw(5) << Result << endl;
    MyOutFile <<"------------------------------------------";
    MyOutFile << "Array 2:" << setw(5) << Result << endl;
    MyOutFile <<"------------------------------------------";
    MyOutFile << "Result:" << setw(5) << Result << endl;
    MyOutFile <<"------------------------------------------";
    
    MyOutFile.close();
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    	return 0;
    }

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,338
    > if (A==1,3,5,7,9,11)
    This is not how you compare the contents of an array with a list of numbers.
    Use a for loop of some sort.

    > srand (time(0));
    Try
    srand ((unsigned int)time(0));
    to fix the "loss of precision" warnings.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ errors help
    By mkmk007 in forum C++ Programming
    Replies: 11
    Last Post: 10-24-2009, 05:38 AM
  2. 26 errors! Why??
    By money? in forum Windows Programming
    Replies: 10
    Last Post: 06-17-2003, 12:54 PM
  3. errors.. errrors.. more errors
    By Klinerr1 in forum C++ Programming
    Replies: 17
    Last Post: 07-23-2002, 08:43 PM
  4. these are the errors
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 03-18-2002, 09:16 PM
  5. MFC Errors :: C++
    By kuphryn in forum C++ Programming
    Replies: 3
    Last Post: 02-11-2002, 08:46 AM

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