![]() | |
| |||||||
| Home | Register | Blogs | FAQ | Members List | Calendar | Downloads | Arcade | Mark Forums Read |
| Languages, Compilers and Interpreters C,C++,C#,.NET,Java,PHP,Perl,SQL and more |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 |
| Дошкольник Join Date: Apr 2003 Location: USA
Posts: 103
Rep Power: 6 Reputation:
10 | Guys i have a question about comparing strings.For example string word1; string word2; word1="Tremendous"; word2="Tremble"; word1<word2; The boolean value will be false , cause computer compares each character one by one and as "b" has lesser value in ASCII than "e", it gives a false value. So the question is , can computer stop at the first character in the string, meaning that it will compare just "T" and set the boolean value to true?
__________________ No se preocupe, sea feliz ! Last edited by Diane- : Jun 11, 2003 at 17:37. |
| | |
| | #2 |
| Грустно... | 1. the value 'b' is less than the value 'e' but you are true, word1 < word2 is false.2. If computer stops after the first symbol the result will be false , because 'T' < 'T' is false ('T' <= 'T' is true). Лучше скажите нам, что вам нужно... ![]()
__________________ http://аvitya.livejournal.com Хотели, как лучше, а получилось даже хуже... Лозунг шахматиста: На каждый шах - ответим матом! |
| | |
| | #3 |
| Banned Join Date: Oct 2002 Location: Brooklyn, New York
Posts: 3,760
Rep Power: 0 Reputation:
10 | 1. dobav'te proverochku na dlinnu stroki (smotrya chto vam nujno... esli ugodno schitaite dlinnuiu stroku bol'shei) 2. v ostal'nix sluchayax vse pral'no. (esli dlinna ravna) 3. chestno govorya ya ne ochen' ponyal vopros.... |
| | |
| | #5 |
| Дошкольник Join Date: Apr 2003 Location: USA
Posts: 103
Rep Power: 6 Reputation:
10 | Agregat yes u right , thats what i wanted to write, but somehow managed to write in the wrong way.And I know that "T"<"T" will be false, thats not what i was asking. Nam nichego ne nujno ,nujen bil otvet na etot vopros, vozmojno li ostanovit posle pervoi bukvi. Danyer ,"dobavit proverochki" kak na angliyskom budet zvuchat? ![]() Eto ne svyazano s kakim to imenno projectom i ya znayu chto etot privedennii mnoyu primer veren. vopros lij v tom, mojli li ostanovit computer posle pervoi bukvi, v lubom sravnenii string-ov. Neznayu kak vam eshe obyasnit ![]()
__________________ No se preocupe, sea feliz ! |
| | |
| | #6 |
| Banned Join Date: Oct 2002 Location: Brooklyn, New York
Posts: 3,760
Rep Power: 0 Reputation:
10 | mojno. 1. proveryai TOL'KO pervuiu bukvu (if(s1[0]==s2[0])) 2. s[i] i nachinai s 0 ne narashivai. chto to je samoe chto i s1[0] ---------- add a condition checking e.g. if ( strlen(s1) > strlen(s2)) i t.d. biblioteka string.h |
| | |