Hello,
I'm kinda new to C++ so I need some help. I've written this program and now I need it modified to possibly do the following...
Output every 4th letter from the string or
Count the occurrences of different letters.
This is simple, basic C++ using Microsoft Visual C++ 1.52 (1993), yes i know ancient but it needs to be done this way.
Thanks in advance..
Jason K
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
void main()
{
srand((unsigned)time(NULL));//Needed for random
char abc[]="abcdefghijklmnopqrstuvwxyz";
char user[256];
int numletters;
cout<<"How many letters do you want in your random string? ";
cin>>numletters;//User Input
for(int i=0;i<=numletters;i++)
{
if(i==numletters)//end the string
user[i]='\0';
else
user[i] = abc[rand()%26+0];//Pick a random spot in alphabet array and assign it to new string
}
cout<<"\n"<<user;
}