איך אני יכול לשלוח לך את התכנית
אם בכלל לא כתבתי אותה?
פרסמי מה כתבת ואיפה נתקעת וננסה לכוון אותך.
אם אין לך מושג אפילו מהיכן להתחיל, הסתכלי על הרמזים שכבר כתבו לך.
הנה פסודו קוד שיעזור לך:
הרעיון הכללי הוא להבין מה האות שהתקבלה ולרוץ מ-A (או a) ועד אליה.
בכל איטרציה כותבים את האות הנוכחית מספר פעמים כמספר האיטרציה ועוד אחד.
האם את יודעת אריתמטיקה של תווים? אם האריתמטיקה לא ברורה בקוד המצורף, את מוזמנת לשאול ואני אבהיר יותר.
char maxChar; //this is the character you received from the user
char baseChar; //This is the base character to start the string from. It will be either 'a' or 'A'
//First we decide where to start from and if we print a small letters' string or a capital letters' string
if('a' <= maxChar && maxChar <= 'z'){ //"regular" letter
baseChar = 'a';
} else if ('A' <= maxChar && maxChar <= 'Z'){ //Capital letter
baseChar = 'A';
}else{
//ERROR - only alphabetic letter is allowed
}
//Now we are printing the string
int currentIteration; //This will be the index of the current iteration
char currentChar = basrChar; //This is the character we are currently writing. Starting from the base Character
while(currentChar <= maxChar){ //Outer loop: Deciding which character to write each time
for(currentIteration = 0 ; currentIteration <= currentChar - baseChar ; currentIteration++){ //Inner loop. Deciding how many times to print each character
//Print the character
}
currentChar++; //Moving to the next character
}