C++Syntax

#include "stdafx.h"
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;

int main()
{
	srand(time(0));
	
	int arr[10]={0};

	for(int i=0;i<10;i++)
	{
		arr[i]=rand()%50+1;}
	
	for(int i=0;i<10;i++){

		cout<<arr[i]<<endl;
	
	}
	return 0;
}

I want to use the * to display the output, what I should improve?

>>I want to use the * to display the output,
Not entirely sure what you mean. Do you mean you want to use pointer arithmetic instead of array indices (not that there's really that big of a difference)?

i.e. use std::cout << *(anArray + anIndex); instead of std::cout << anArray[anIndex]; ???

My English is not good. I want to use the "*" replace the number to display .
My assignment is that use the random 50 integer number and range from 1 to 10 and use the array to store it.Then use the"*" to display the output variable.

So, if the RNG generates a '5', do you want to display 5 '*' characters?
i.e. if random = 5, the output is '*****'

Or do you want to arrange several '*' characters into the shape of a 5?
something like this:

******
**
**
***** 
    **
    **
*****

??

The difference in complexity is astronomical.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.