Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
258 views
in Technique[技术] by (71.8m points)

c# - Am I using boolean values in the wrong place? Console output does not appear

I have a 4-line poem. I read this poem line by line from the text, flip the sentence over and assign it to the array. The purpose of my inversion is to find the rhymes at the end of the poem. In my code I try to find the word ryhme. For example - Lifting her arms to soap hair
"She wrings the water from her hair. Here is the word rhyme hair. I put the hair in the array by letter by letter. But when I want to show it on the console, the output does not appear. Where do I go wrong?" //

      string[] ss2 = new string[reversed.Length-1];
        bool flagword = false;
        
        int sayac = 0;
        for (i = 0; i < linenum - 1; i++) //word
        {
            int k = 0;
            while (reversed[i].Substring(k, 1) == reversed[i + 1].Substring(k, 1))
            {
                ss2[i] += reversed[i].Substring(k, 1);
                k++;
                flagword = true;
            }
            if (reversed[i].Substring(k, 1) == " ") sayac++;
        }
        if (flagword && sayac != 0) 
        {
            Console.WriteLine(ss2[1]);
        }
       

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...