Note that there are some explanatory texts on larger screens.

plurals
  1. POwarning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data -- C++
    text
    copied!<p>I made a simple program that allows the user to pick a number of dice then guess the outcome... I posted this code before but with the wrong question so it was deleted... now I cannot have any errors or even warnings on this code but for some reason this warning keeps popping and I have no clue how to fix it... <strong>"warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data"</strong></p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cstdlib&gt; #include &lt;time.h&gt; using namespace std; int choice, dice, random; int main(){ string decision; srand ( time(NULL) ); while(decision != "no" || decision != "No") { std::cout &lt;&lt; "how many dice would you like to use? "; std::cin &gt;&gt; dice; std::cout &lt;&lt; "guess what number was thrown: "; std::cin &gt;&gt; choice; for(int i=0; i&lt;dice;i++){ random = rand() % 6 + 1; } if( choice == random){ std::cout &lt;&lt; "Congratulations, you got it right! \n"; std::cout &lt;&lt; "Want to try again?(Yes/No) "; std::cin &gt;&gt; decision; } else{ std::cout &lt;&lt; "Sorry, the number was " &lt;&lt; random &lt;&lt; "... better luck next time \n" ; std::cout &lt;&lt; "Want to try again?(Yes/No) "; std::cin &gt;&gt; decision; } } std::cout &lt;&lt; "Press ENTER to continue..."; std::cin.ignore( std::numeric_limits&lt;std::streamsize&gt;::max(), '\n' ); return 0; } </code></pre> <p>This is what I am trying to figure out, why am I getting this warning: warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload