Link to home
Start Free TrialLog in
Avatar of gjgomez
gjgomez

asked on

How to use numerical representation of a character to insert in a string???

Consider I want to check in a string for many values. Let's say I have the value char letter = 'a', and I want to insert it in every position of a string, let's say "home". Then I want to check for letter = 'b' in the same string "home", and just like that I want to check for every letter in the alphabet nad insert it in the string "home"
Is there a way to use the numerical representation of a char 'a' to insert in a string, and then increase a count so that the next value of char is 'b', and so on until we reach 'z'???
Thanks.
Avatar of beryl666
beryl666
Flag of United States of America image

don't understand your question. explain more please.
ok let me do this:

you want to change the char letter='a'; and make it increase in numeric until z
#include<iostream>
#include<conio.h>

using namespace std;

int main()
{
    char letter = 'a';
   
    for(int i=0;i<26;i++)
    cout<<char(letter+i);
 
 getch();
 return 0;  
}
ASKER CERTIFIED SOLUTION
Avatar of beryl666
beryl666
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial