Hey,<br />Im not sure if theres a spot for the Basic language or not and im not really a big fan of getting answers for my work but since programmings a pain in the arse and my work needs to get done here i go. Plus its good to get help from people who have experience in programming as you can teach me more. <br /><br />Okay the assignment is from Qbasic Second edition if this helps, page 296 #5. I basically need to make a program that takes a sentence or word and changes the uppercase to lowercase and vice versa using ASC. My professor specified that i need to use READ and DATA functions even though we haven't covered them and i cant even find them in our book lol. but anyways this is what i have but all i can do is change the first letter. I know i need to add more but i cant get it to work properly when i try to check and change the 2nd, 3rd, 4th etc letter. The do while i was trying to use as a counter type thing to check each letter untill there are none left but forgot to take that out from old code and may not be needed but i am unsure as it has to have some way to know what letters have been checked and haven't. <br /><br />Any suggestions would be appreciated. <br /><br /><script language="javascript" src="http://www.dreamincode.net/syntax/shBrushvb.js"></script>
<div class='codetop'>vb</div><div class='codemain' style="padding: 0px !important;"><pre name="code" class="vb"><br /><br />CLS<br /><br />READ sentence$<br />INPUT "Enter your sentence: ", sentence$<br /><br />DATA Baah, Ram, Ewe,<br /><br />CALL letterchange(sentence$)<br /><br />END<br /><br /><br />SUB letterchange (sentence$)<br /><br />length = LEN(sentence$)<br /><br />DO WHILE length > 0<br /><br />length = length - 1<br />X = ASC(sentence$) '** Turns into ASC number<br /><br />IF (X >= 65 AND X <= 90) THEN<br />Y$ = CHR$(X) '** Turns back to Letter<br />Y$ = LCASE$(Y$) + UCASE$(MID$(sentence$, 2))<br />END IF<br /><br /><br />IF (X >= 97 AND X <= 122) THEN<br />Y$ = CHR$(X)<br />Y$ = UCASE$(Y$) + UCASE$(MID$(sentence$, 2))<br /><br />END IF<br /><br />LOOP<br /><br /><br />PRINT "-------------------------"<br />PRINT<br />PRINT Y$<br />PRINT<br /><br /><br />END SUB<br /><br /></pre></div>
</div>
<div class='codetop'>vb</div><div class='codemain' style="padding: 0px !important;"><pre name="code" class="vb"><br /><br />CLS<br /><br />READ sentence$<br />INPUT "Enter your sentence: ", sentence$<br /><br />DATA Baah, Ram, Ewe,<br /><br />CALL letterchange(sentence$)<br /><br />END<br /><br /><br />SUB letterchange (sentence$)<br /><br />length = LEN(sentence$)<br /><br />DO WHILE length > 0<br /><br />length = length - 1<br />X = ASC(sentence$) '** Turns into ASC number<br /><br />IF (X >= 65 AND X <= 90) THEN<br />Y$ = CHR$(X) '** Turns back to Letter<br />Y$ = LCASE$(Y$) + UCASE$(MID$(sentence$, 2))<br />END IF<br /><br /><br />IF (X >= 97 AND X <= 122) THEN<br />Y$ = CHR$(X)<br />Y$ = UCASE$(Y$) + UCASE$(MID$(sentence$, 2))<br /><br />END IF<br /><br />LOOP<br /><br /><br />PRINT "-------------------------"<br />PRINT<br />PRINT Y$<br />PRINT<br /><br /><br />END SUB<br /><br /></pre></div>
</div>