473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

why does the following not run ?

Expand|Select|Wrap|Line Numbers
  1. #include <iostream> 
  2. #include <ctime> 
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. int main() 
  8.     srand((unsigned)time(0)); 
  9.     int random_integer; 
  10.     int lowest=1, highest=10; 
  11.     int range=(highest-lowest)+1; 
  12.     for(int index=0; index<20; index++){ 
  13.         random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0)); 
  14.         cout << random_integer << endl; 
  15.     } 
  16. }
Sep 23 '07 #1
1 1034
JosAH
11,448 Expert 8TB
#include <iostream>
#include <ctime>
#include <cstdlib>

using namespace std;

int main()
{
srand((unsigned)time(0));
int random_integer;
int lowest=1, highest=10;
int range=(highest-lowest)+1;
for(int index=0; index<20; index++){
random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0));
cout << random_integer << endl;
}
}
Is it a compilation error? Did you forget to compile it? A runtime error? Did you
forget to run it? Did your cat chew on the AC cable? Did you spill coke or whatever
beverage on your keyboard? What, by Jove, was the error you didn't expect.
Sorry, Sunday is my psychic day off.

kind regards,

Jos
Sep 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
0
by: Dirk Försterling | last post by:
Hi all, a few days ago, I upgraded from PostgreSQL 7.2.1 to 7.4, following the instructions in the INSTALL file, including dump and restore. All this worked fine without any error (message). ...
1
by: Wendy Elizabeth | last post by:
Can you give me some suggestions of why the xml web service is not working? I have an xml web service that works in my visual studio. net 1.1 environment. I setup this project up for deployment...
11
by: Brian W | last post by:
Yet another editor problem To reproduce do the following 1) Open a Webform and switch to HTML edit mode 2) Enter the Following (include spaces) This is some text before <asp:hyperlink...
1
by: Wendy Elizabeth | last post by:
Can you give me some suggestions of why the xml web service is not working? I have an xml web service that works in my visual studio. net 1.1 environment. I setup this project up for deployment...
2
by: Alex | last post by:
Hello, Quick question and I would really appreciate if anybody could helps me. Here are the steps to reproduce the problem. Create simple ASP.Net application. In code behind added protected...
15
by: Pucca | last post by:
I'm getting an error when I tried to use this BerConverter class in my C# code. Even though the Interent doc says that it runs on Win2000 sp4, I just thgouth I'll double check. Does anyone know...
14
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - Why does K = parseInt('09') set K to 0? ----------------------------------------------------------------------- ...
130
by: Daniel Manes | last post by:
I'm baffled. I have a column in a SQL Server Express database called "Longitude," which is a float. When I view the table in a DataGridView, some of the numbers, which only have two decimal places...
2
by: haft | last post by:
My webpage of discussion contains a javascript powered image gallery of small thumbnail images that when moused-over, display a larger image that corresponds to the current moused-over thumbnail....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.