Quote
#include <iostream>
using namespace std;
int main()
{
int random;
int number;
for (int random=1; random <= 30; random++)
cin << number;
return 0;




Posted 06 April 2010 - 03:35 PM
Quote
#include <iostream>
using namespace std;
int main()
{
int random;
int number;
for (int random=1; random <= 30; random++)
cin << number;
return 0;
Posted 06 April 2010 - 03:38 PM
Quote
Posted 06 April 2010 - 03:38 PM
Posted 06 April 2010 - 03:50 PM
japanir, on 06 April 2010 - 02:38 PM, said:
Quote
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
int random;
srand(time(0));
{
for(int random=1; random <= 30; random=*++)
cout << "random" << endl;
}
return 0;
Posted 06 April 2010 - 03:53 PM
PatTheGamer, on 06 April 2010 - 02:38 PM, said:
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
int random;
srand(time(0));
{
for(int random=1; random <= 30; random=*++)
cout << "random" << endl;
}
return 0;
Quote
Posted 06 April 2010 - 03:56 PM
for(int random=1; random <= 5; random++)
random=*++
random++
Posted 06 April 2010 - 04:04 PM
japanir, on 06 April 2010 - 02:56 PM, said:
for(int random=1; random <= 5; random++)
random=*++
random++
Quote
Posted 06 April 2010 - 05:38 PM
int randNum = rand() % 30 + 1;
//main loop to iterate 5 numbers
for(int i = 1; i <= 5; i++){
//generate random number
int randNum = rand() % 30 + 1;
//the nested loop to print asterisks the amount of the randNum
for(int j = 0; j < randNum; j++){
cout<<"*";
}
//new line for each number
cout<<endl;
}
Posted 06 April 2010 - 05:49 PM
japanir, on 06 April 2010 - 04:38 PM, said:
int randNum = rand() % 30 + 1;
//main loop to iterate 5 numbers
for(int i = 1; i <= 5; i++){
//generate random number
int randNum = rand() % 30 + 1;
//the nested loop to print asterisks the amount of the randNum
for(int j = 0; j < randNum; j++){
cout<<"*";
}
//new line for each number
cout<<endl;
}
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
int random;
srand(time(0));
{
int random = rand() % 30 + 1;
for(int random=1; random <=5; random++)
{
cout << "*" << endl;
return 0;
}
Quote
Posted 06 April 2010 - 06:32 PM
int random;
...
int random = rand() % 30 + 1;
...
for(int random=1;
..
srand(time(0));
{ //<<why do you need those?
for(int random=1; random <=5; random++)
{//if you open curly braces, why not close them?
Posted 06 April 2010 - 08:01 PM
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
int random;
int randNum = rand() % 30 + 1;
{
for(int random=1; random <=5; random++)
{
cout << "*";
}
}
cout << endl;
return 0;
}
Quote
Posted 07 April 2010 - 05:51 AM
#include <iostream>
using namespace std;
int main(){
//main loop to iterate 5 numbers
for(int i = 1; i <= 5; i++){
//generate random number
int randNum = rand() % 30 + 1;
//the nested loop to print asterisks the amount of the randNum
for(int j = 0; j < randNum; j++){
cout<<"*";
}
//new line for each number
cout<<endl;
}
return 0;
}
