#include <iostream>
#include <string.h>
#include <string>
usingnamespace std;
/*A B C Ç D E F G Ğ H I İ J K L M N O Ö P R S Ş T U Ü V Y Z
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29*/
int alphabet()
{
int result;
string name;
char alphabet[]={'A','B','C','Ç','D','E','F','G'};
alphabet[0]=1;
alphabet[1]=2;
alphabet[2]=3;
alphabet[3]=4;
alphabet[4]=5;
alphabet[5]=6;
alphabet[6]=7;
alphabet[7]=8;
cout<<"Enter your name and surname :";
getline (cin,name);
for(int i=0; i<=yazi.length()-1 ; i++)
{
name= alphabet[i]+alphabet[i];
}
cout<<"Result is<< name;
return 0;
}
int main()
{
alphabet();
}
Each word has a value like A=1,B=2,C=3...When user type his/her name the program would calculate each word and then show the result such as
Enter your name : EGE
Result is : 20;
I know that a so easy program but i really cant do that.how can i fix ?
i have been trying something for hours but i cant get a right result.
MorningStar thank you so so so much your code is very good but i have to add something too.When i type something like "EGE AGE" it calculates wrongly it doesnt release the space of the name(although sub -1 from length of the name) and also i would like to type Turkish Chars "Ç,Ş,Ğ" how can i do that? i know you will be mad at me but forgive me for my asking.