Server Help

Non-Subspace Related Coding - c switch problem

tcsoccerman - Thu Feb 15, 2007 5:11 pm
Post subject: c switch problem
I'm trying to do a switch statement when you enter a name and then it gives you a definition. here's my coding for it.

Code: Show/Hide
verb()
    {
      char verb[20];
      const char aprender[8];
      int here;
      printf("Now type the verb:\n");
      scanf("%s",&verb);
      switch(verb[20])
      {
          case aprender[8]:
      {
      printf("Aprender means to learn/understand\n");
      }
      return here;


it's obviously a spanish translator. when i compile it (using dev c++) it says "case label does not reduce to an int constant".
does this mean a case statement needs to be for an int, and can't be for a char[]? i also have a problem with the return statement sometimes. can someone tell me another word besides the return statement because i know this isn't the right way to do it. i'vetried to find a answer but this seems to be the best way for now since the continuum community is filled with coders. ty in advance.

p.s. cyan fire~: i know c++ is better for you, i'm learning c to get started.
p.s.s let me know if you want the entire .c file
Bak - Thu Feb 15, 2007 5:25 pm
Post subject:
yeah switches have to be ints..

try using

if (strcmp(verb,"aprender") == 0)
printf("to learn");
tcsoccerman - Thu Feb 15, 2007 6:00 pm
Post subject:
ty for reply, i did what you said before i looked at reply but did this instead:


Code: Show/Hide


if ( strcmp (language[10], "english") =="%c means %c",english spanish;




i'll try out what you said. ty
tcsoccerman - Thu Feb 15, 2007 6:06 pm
Post subject:
Also, if you have for example:

printf("%d = %d", english spanish);

is taht how you would declare waht integer %d is printing. if not could you plz tell me. ty.

Edit: ok, this is so screwd up, here's my code. i need it more clean i don't think the things i'm doing are correct. ty.

Code: Show/Hide

definition(char language[10], char english[25], char spanish[25])
{
       
       while
       {
                (strcmp(language,"english") == 0);
                }   
       printf("%s = %s", english[25], spanish[25]);
           while
           {
            (strcmp (language, "spanish") ==0);
            }
       printf("%c means %c", spanish[25], english[25]);
       }
       return verb();       

ty for any help. it just seems screwy.
Cyan~Fire - Thu Feb 15, 2007 6:40 pm
Post subject:
OK, I'm not trying to be mean here, but there's no point in me explaining the entire language to you. C++ Tutorial. I'm glad you're using printf(), continue to do so even though the tutorial uses cin/cout.

You seem to have an understanding of the very basics, so I'd suggest starting with "Control Structures"
Bak - Thu Feb 15, 2007 7:05 pm
Post subject:
Code: Show/Hide

void definition(char language[10], char english[25], char spanish[25])
{
       
       if (strcmp(language,"english") == 0)   
       {
              printf("%s = %s", english, spanish);
       }       
       else
       {     
              printf("%s means %s", spanish, english);
       }
}

tcsoccerman - Thu Feb 15, 2007 7:51 pm
Post subject:
Question:why are you glad i'm using printf()? are you just respecting my opinion on c? if so ty. That tutorial was somewhat likehttp://www.cprogramming.com/tutorial.html#ctutorial except they teach different things in different orders. kinda not liking switching over to that ""tutorial" plainly because of it's different order. It could be the other way areound if i started with you're site.

Edit: i looked for the answer at you're site but couldn't find it:

Q:If you have declared a function with arguements including character's that have more than 1 elements and therefore have a [25] after them, what do you do when you use the funcion? do you include the [25] after the word you're replacing the char for? here's my coding:

Code: Show/Hide
char definition(char language[10], char english[25], char spanish[25])
{
       
       if (strcmp(language,"english") == 0)   
       {
              printf("%s = %s", english, spanish);
       }       
       else
       {     
              printf("%s means %s", spanish, english);
       }
}


which is for the function, now i'm calling the function up:

Code: Show/Hide

char definition(english[10], learn[25], aprender[25]);


it shouldn't be too hard of a question. btw c++ looks a lot more easier and efficient! wow.ty in advance i hope. last question for a while. i promise
Bak - Fri Feb 16, 2007 3:09 am
Post subject:
when you do things like
Code: Show/Hide
variable_type variable_name[size];


you're not just making a single variable, you're making a whole bunch of them. So in the example I gave, you will get <size> different variables of type <variable_type>(int, or char, for example).

In your example you're using entire words which are in reality just a bunch of characters. So "char language[10]" means a group of ten variables of type "char".

you use the []'s to refer to the individual characters in regular code (not in the function declaration), use just the variable name usually when you want to refer to the whole word. That's probably enough detail for now, there's actually a good reason for all of this, which you'll learn later if you keep coding.

Try to figure out what the following code will print, then run it:
Code: Show/Hide

char string[10] = "english";

printf("string is '%s', string[1] is '%c', string[2] is '%c'\n",
               string, string[1], string[2]);

Smong - Fri Feb 16, 2007 5:33 am
Post subject:
Code: Show/Hide
char definition(char language[10], char english[25], char spanish[25])
{
...
}
You're not returning anything, so "char definition(...)" should be "void definition(...)".

To call the function you can use something like:
Code: Show/Hide
definition("english", "learn", "aprender");

Dr Brain - Fri Feb 16, 2007 7:57 am
Post subject:
Cyan~Fire wrote:
I'm glad you're using printf(), continue to do so even though the tutorial uses cin/cout.


Cyan, printf() is less efficient (which, if I recall, is your primary gripe with Java), and it also doesn't do type checking. There's a reason every C++ tutorial uses it, and it's not because they've never heard of printf().
Cyan~Fire - Fri Feb 16, 2007 10:24 am
Post subject:
tcsoccerman, I suggested that tutorial because I was under the impression that you weren't using a tutorial and just trying to put together code from what you'd seen in MERVBot or something. Sure, stick with whatever tutorial you're using, but you do (did, I guess, if you got what BaK said) need to relearn how functions work, so start there.


Brain,
Code: Show/Hide
/*
        Func          Func+Child           Hit
        Time   %         Time      %      Count  Function
---------------------------------------------------------
       0.290  48.2        0.290  48.2       10 complex_output(void) (etest.obj)
       0.224  37.1        0.224  37.1       10 just_a_string_printf(void) (etest.obj)
       0.081  13.4        0.081  13.4       10 just_a_string_puts(void) (etest.obj)
       0.008   1.3        0.603 100.0        1 _main (etest.obj)
      */

#include <stdio.h>

void just_a_string_printf()
{
   printf("using printf\n");
}

void just_a_string_puts()
{
   puts("using puts   ");
}

void complex_output()
{
   printf("%s is the %d-best game in the world\n", "Continuum", 21);
}

int main()
{
   int i;

   i = 10;
   while (i--)
      just_a_string_printf();

   i = 10;
   while (i--)
      just_a_string_puts();

   i = 10;
   while (i--)
      complex_output();

   return 0;
}

Code: Show/Hide
/*
        Func          Func+Child           Hit
        Time   %         Time      %      Count  Function
---------------------------------------------------------
       2.741  75.8        2.741  75.8       10 complex_output(void) (etest_cout.obj)
       0.873  24.1        0.873  24.1       10 just_a_string(void) (etest_cout.obj)
       0.003   0.1        0.004   0.1        1 _$E25 (etest_cout.obj)
       0.001   0.0        0.001   0.0        1 _$E22 (etest_cout.obj)
       0.000   0.0        0.000   0.0        1 _$E28 (etest_cout.obj)
       0.000   0.0        0.000   0.0        1 _$E23 (etest_cout.obj)
       0.000   0.0        0.000   0.0        1 _$E24 (etest_cout.obj)
       0.000   0.0        0.000   0.0        1 _$E29 (etest_cout.obj)
       0.000   0.0        0.000   0.0        1 _$E30 (etest_cout.obj)
       0.000   0.0        0.000   0.0        1 _$E31 (etest_cout.obj)
       0.000   0.0        3.614  99.9        1 _main (etest_cout.obj)
*/

#include <iostream>

using namespace std;

void just_a_string()
{
   cout << "using cout\n";
}

void complex_output()
{
   cout << "Continuum" << " is the " << 21 << "-best game in the world\n";
}

int main()
{
   int i;

   i = 10;
   while (i--)
      just_a_string();

   i = 10;
   while (i--)
      complex_output();

   return 0;
}

So complex_output() using printf() was actually faster than just_a_string() using cout so you can't even argue that cout is better in certain cases.

I guess it's possible that VC6 has a crappy version of the STL, but it's definitely not faster for me at least. By the way, these are compiled using MSVCRT.dll instead of static linking because I couldn't get the second file to compile for some reason (seems to be an issue with the new /GS switch that VC6 doesn't support... I don't really know).
Bak - Fri Feb 16, 2007 12:51 pm
Post subject:
honestly, how much printing do your programs do? console output isn't the bottleneck in any resonable program; optimize where it matters.
Dr Brain - Fri Feb 16, 2007 1:28 pm
Post subject:
Cyan, I've already tested the speed differences: http://forums.minegoboom.com/viewtopic.php?p=59625#59625

I assume you didn't compile in release mode when you timed everything.

Cyan, you may find this link amusing: http://forums.minegoboom.com/viewtopic.php?p=28316#28316

Bak, of course it doesn't matter how fast it is. I just get tired of hearing people say that efficiency is the greatest thing in the world and promoting printf at the same time. I have nothing against printf, just the zealots that hate iostream.
Cyan~Fire - Fri Feb 16, 2007 3:16 pm
Post subject:
Brain wrote:
Cyan, I've already tested the speed differences: http://forums.minegoboom.com/viewtopic.php?p=59625#59625

Ahh right, I had forgotten about that. I'll have to try your source files once I get home, too.

Brain wrote:
I assume you didn't compile in release mode when you timed everything.

I did.

Brain wrote:
Cyan, you may find this link amusing: http://forums.minegoboom.com/viewtopic.php?p=28316#28316

I hope you'll notice I'm not putting down printf() there, I was actually just using Ekted's printf() dogma to point out his hypocrisy. I do not consider myself a prinf "zealot" (or at least not on Ekted's level), I simply made a comment here that I'm happy that tcsoccerman is using it. And you start arguing. Who's the zealot?

More related, there are two possible explanations for the differences between our tests. A possibly crappy version of STL in VC6, which I mentioned earlier, or that STL handles integers better, but strings worse. Your test programs only outputted integers, mine did a string and an integer. I'll have to play with it later.

BaK wrote:
honestly, how much printing do your programs do? console output isn't the bottleneck in any resonable program; optimize where it matters.

Definitely agreed. Even if Brain could prove to me that iostreams are faster than stdio in every single case, I'd still use stdio because I prefer the interface.
D1st0rt - Sun Feb 18, 2007 3:34 pm
Post subject:
I prefer printf because it's easier for me to do formatting with it, and that's about it.
Animate Dreams - Sun Feb 18, 2007 9:53 pm
Post subject:
I only prefer printf() when it comes to really complex formatting. Well, basically, I just hate iomanip, and would use printf() to avoid using anything held in iomanip. It probably annoys my professors, but they've yet to dock me any points for it, it's not like I can't do it in iostream. Besides, I doubt it's really going to hurt me in the future if I never learn std::setiosflags.
Cyan~Fire - Mon Feb 19, 2007 12:23 am
Post subject:
Animate wrote:
Besides, I doubt it's really going to hurt me in the future if I never learn std::setiosflags.

It might. Learning the STL is definitely a good idea in today's world, you never know when you'll be forced to use it.

By the way, I got the following timings for Brain's files:
Code: Show/Hide
/*

        Func          Func+Child           Hit
        Time   %         Time      %      Count  Function
---------------------------------------------------------
    1915.341 100.0     1915.341 100.0        1 _main (brain_iostream.obj)
       0.002   0.0        0.003   0.0        1 _$E25 (brain_iostream.obj)
       0.001   0.0        0.001   0.0        1 _$E22 (brain_iostream.obj)
       0.000   0.0        0.000   0.0        1 _$E23 (brain_iostream.obj)
       0.000   0.0        0.000   0.0        1 _$E28 (brain_iostream.obj)
       0.000   0.0        0.000   0.0        1 _$E29 (brain_iostream.obj)
       0.000   0.0        0.000   0.0        1 _$E24 (brain_iostream.obj)
       0.000   0.0        0.000   0.0        1 _$E30 (brain_iostream.obj)
       0.000   0.0        0.000   0.0        1 _$E31 (brain_iostream.obj)

*/
/*
        Func          Func+Child           Hit
        Time   %         Time      %      Count  Function
---------------------------------------------------------
     914.573 100.0      914.573 100.0        1 _main (brain_printf.obj)
    */

Who knows? The only explanation I can think of is our libraries, so I guess that's it. Anyway, the time difference is so tiny that it, as has been mentioned, is really just a personal choice. Actually, what we should do is file I/O because that's where I noticed a real speed difference in a real-world application instead of these synthetic stuff.
tcsoccerman - Mon Feb 19, 2007 6:49 pm
Post subject:
Wow. what a nice discussion to come home too. I'll compile my program and see if it works.

@cyanfire:
functions to "start" with. I do understand functions and the basics of what they do, just not polished in that area.

@bak:

i know what that would say lol. i understand char's quite well. it would say "english e n". or is the stupid starting at 0 rule in affect? then it would say "english n g". anyway thanks for help anyways. i hope it works.


edit - worked icon_wink.gif
tcsoccerman - Tue Feb 20, 2007 5:09 pm
Post subject:
this is awkward. take a look at the codeing:

Code: Show/Hide
printf("Now type the verb:\n");
      scanf("%s",&verb);
      if (strcmp (verb, "aprender"))
         {
         definition("english", "learn", "aprender");
         }
      else (strcmp (verb, "beber"))
         {
         definition("english", "beber", "drink");
         }
      else if (strcmp (verb, "comer"))
         {   
         definition("english", "comer", "eat");
         }
     


the definition() function:

Code: Show/Hide
void definition(char language[10], char english[25], char spanish[25])
{
       
       if (strcmp(language,"english") == 0)   
       {
              printf("%s = %s\n", english, spanish);
       }       
       else
       {     
              printf("%s means %s\n", spanish, english);
       }

       return verb();       



and display:

Code: Show/Hide
Welcome to Scott's Beginner level translater, what
subject would you like to work on?
1.verbs
2.nouns
3.greetings
4.rules
5.Entire library
1
|==================================================|
|Form   Ar Verbs    Er verbs    Ir verbs   Example=|
|==================================================|
|Yo--------o-----------o----------o--------hablo---|
|Tu--------as----------es---------es-------halblas-|
|El--------a-----------e----------e--------escribe-|
|Ud.-------a-----------e----------e--------aprenede|
|Ella------a-----------e----------e--------bebe----|
|Uds.------an----------en---------en-------aprenden|
|Ellos-----an----------en---------en-------comen---|
|Ellas-----an----------en---------en-------leen----|
|Nosotros--amos--------emos-------imos-----leimos--|
|Nosotras--amos--------emos-------imos-----bebimos-|
|==================================================|
You've chose verbs. type a word and it
will translate for you
Now type the verb:
aprender         right here these two lines are awkward
beber = drink      and here these two lines are awkward
Now type the verb:
learn
learn = aprender
Now type the verb:




isn't that awkward. is there a way to do this:
Code: Show/Hide
if (strcmp (verb, "aprender"))==[b]1[/b]


and then take the 1 and have it in a switch statement like this:
Code: Show/Hide
switch(verb)
case [b]1[/b]:
{
printf("aprender means to learn\n");
}

it annoys me you can't do switch statements with char's

new_let_it_all_out.gif new_let_it_all_out.gif new_let_it_all_out.gif new_let_it_all_out.gif new_let_it_all_out.gif new_let_it_all_out.gif new_let_it_all_out.gif new_let_it_all_out.gif new_let_it_all_out.gif new_let_it_all_out.gif

anyway, it be nice if you could help in telling me a way to do a char. switch statement thing. ty.

p.s. to those who think i am posting too much, i agree. there are so many good coder's here though and everywhere i tried i couldn't find a solution(on the internet at least, don't have a book)
ty again.
Mine GO BOOM - Tue Feb 20, 2007 8:05 pm
Post subject:
tcsoccerman wrote:
it annoys me you can't do switch statements with char's

I'll assume you mean switch statements on char arrays. This was never part of C because switch statements are not directly the same as a bunch of if/else statements. Most compilers will optimize a switch statement into a small batch of jumps or a table lookup, which is complex to handle unless the data is an integer.

strcmp returns 0, less than 0, or greater than 0. You cannot assume that it will only return 0, -1, or 1, so you should not use the return of strcmp in a switch statement.

If you want to do a bunch of strcmp tests, a simple way is to just use a bunch of if statements.
Code: Show/Hide
if (!strcmp(input, "english"))
   printf("You inputed English.");
else if (!strcmp(input, "spanish"))
   printf("I'm sorry, I forgot Spanish a bunch of years back. Que pasa?");
else if (!strcmp(input, "backdoor"))
   printf("Welcome master, how many I do your bidding?");
else
   printf("ERROR 0x0000072");

Remember, strcmp returns 0 if it is a match. Your example code is all screwed up. Use ! or == 0.
Bak - Wed Feb 21, 2007 6:35 am
Post subject:
careful, you have to put your parameters in the right order:

Code: Show/Hide
definition("english", "beber", "drink");

Code: Show/Hide
definition("english", "comer", "eat");


"drink and "eat" should be before "beber" and "comer"
tcsoccerman - Wed Feb 21, 2007 3:21 pm
Post subject:
ty. MGB hit the answer right on the button though. The tutorial example's only show 1 "else if" so it doesn't seem as if they can be used many times like i needed to. I'll keep this in mind to tell if i ever help someone as well.
tcsoccerman - Wed Feb 21, 2007 3:57 pm
Post subject:
Parse Error before parse error?:

Code: Show/Hide
if (strcmp (verb, "aprender"));
         {
         definition("english", "learn", "aprender");
         return here;
         }
      else if (strcmp (verb, "beber"));
         {
         definition("english", "beber", "drink");
         return here;
         }
      else if (strcmp (verb, "comer"));
         {   
         definition("english", "comer", "eat");
         return here;
         }
      else printf("That word is unkown or spelled incorrectly,
      "remember to put a ""to"" in front of the word such as"
      """to learn""");
     


ty again.
~the stupidist coder in the world
Mine GO BOOM - Wed Feb 21, 2007 4:02 pm
Post subject:
tcsoccerman wrote:
MGB hit the answer right on the button though.

strcmp returns 0 if the strings match. If is only true if the value is not 0. Your if statements are still incorrect.

You need if (strcmp(verb, "aprender") == 0) or if (!strcmp(verb, "aprender")) for the statement to be true when the strings are the same. Notice the ! in the second example, or any of my else-if examples.
tcsoccerman - Wed Feb 21, 2007 7:58 pm
Post subject:
yes i noticed that. i interperted that though as the following and didn't seem it would be right to use it.

"if verb is not "aprender"
statement;

what does it actually mean? ty. by "returning 0" does that quit the program then? i'd look that up online but my dad's bugging me to get off. ty.
Bak - Wed Feb 21, 2007 10:16 pm
Post subject:
get rid of the semicolons after your if statements

get rid of the returns... one return per function

"That word is unkown or spelled incorrectly, should be "That word is unkown or spelled incorrectly, "

""to"" should be \"to\"

"""to learn""" should be "\"to learn\""
SamHughes - Thu Feb 22, 2007 10:51 am
Post subject:
And unkown should be unknown.
tcsoccerman - Thu Feb 22, 2007 3:27 pm
Post subject:
And Bak should stay Bak and answer one last question icon_smile.gif. It says "Missing Terminating " Character" when i compile, here's the code:
Code: Show/Hide
void definition2(char definition[100])
{
   printf("Definition:%s\n", definition);
}

i do terminate with a "..?
i think it's correct. maybe i'm doing something wrong, who know's.
Cyan~Fire - Thu Feb 22, 2007 4:46 pm
Post subject:
I'm not really sure why it's giving that specific error, but
Code: Show/Hide
void definition2(char definition[100])
should be
Code: Show/Hide
void definition2(char *definition)
, as you're not declaring an array here (and therefore you shouldn't specify the size).

You still need to read a good tutorial, you still don't have a good understanding of functions or arrays.
Bak - Thu Feb 22, 2007 5:39 pm
Post subject:
I think his way should work too, cyan.

Anyways the problem isn't in that code tsoccerman. This program compiles fine for me:

Code: Show/Hide

#include <stdio.h>

void definition2(char definition[100])
{
   printf("Definition:%s\n", definition);
}

int main()
{
   definition2("apple");

   return 0;
}


Let's see the rest of your code.
tcsoccerman - Thu Feb 22, 2007 6:22 pm
Post subject:
First, what compiler do you use, msvc? i use dev c++

Edit: that's odd, when i add more text, it's still only line 19, the error isn't that for original problem on line 19 but there's a "new" problem at line 19, different text. probably a bug in compiler and debugger. where can i get a better one like msvc?
Mine GO BOOM - Thu Feb 22, 2007 7:06 pm
Post subject:
tcsoccerman wrote:
probably a bug in compiler and debugger. where can i get a better one like msvc?

I really doubt it is a compiler/debugger bug. Attach your whole source code, and we can look for your syntax errors.
tcsoccerman - Thu Feb 22, 2007 7:31 pm
Post subject:
Ok, i guess there's not really anything worthstealing.

Edit: probelm fixed, passed by Bak's (i believe) word is spelled inclrreclty advise. Make's sense. sorry guys. i wonder why it said it about 30 lines back though. hmm
Anonymous - Tue Apr 17, 2007 9:32 pm
Post subject:
If you can, learn C well, then move to C++. It is much easier to learn that way. If you wrote this same program in C++, you would be doing different things like passing by reference rather then by value which is very ugly. Even in C you should pass a pointer. Passing by a pointer is only putting 4 bytes on the stack rather than, in this case, an array with many elements (by value).
Mine GO BOOM - Wed Apr 18, 2007 3:37 am
Post subject:
unknown1988 wrote:
If you can, learn C well, then move to C++. It is much easier to learn that way. If you wrote this same program in C++, you would be doing different things like passing by reference rather then by value which is very ugly. Even in C you should pass a pointer. Passing by a pointer is only putting 4 bytes on the stack rather than, in this case, an array with many elements (by value).

You have a bit more to learn about C. Even if the function is defined as func(char str[500]), you still pass by reference, not by value. Don't believe me? Give this little script a try. And passing by reference is ugly? I fail to see how.
Code: Show/Hide
#include <stdio.h>
#include <string.h>

void test(char str[20])
{
   strcpy(str, "bob smith");
   printf("&str: %p [%p]   str: %s\n", &str, str, str);
}

int main()
{
   char str[20];

   strcpy(str, "john jones");
   printf("&str: %p [%p]   str: %s\n", &str, str, str);
   
   test(str);
   
   printf("&str: %p [%p]   str: %s\n", &str, str, str);

   return 0;
}

Code: Show/Hide
&str: 0012FF6C [0012FF6C]   str: john jones
&str: 0012FF1C [0012FF6C]   str: bob smith
&str: 0012FF6C [0012FF6C]   str: bob smith

tcsoccerman - Fri May 04, 2007 3:23 pm
Post subject:
how would you declare a function like that in C#? what is the name of a function in c#? gracias.
tcsoccerman - Fri May 04, 2007 3:38 pm
Post subject:
this is the function i have made:

Code: Show/Hide
void definitions(string spanish, string english)
      {
         if (textbox.Text = "aprender");
         {
            labeldef.Text = " aprender means to learn";
         }


which will be declared here:

Code: Show/Hide
void ButtonClick(object sender, EventArgs e)
      {
         labeltitle.Text = textbox.Text;
         toolStripStatusLabel.Text = "Finding Definition...";
         void definitions(aprender, english);

Samapico - Sat May 05, 2007 1:34 am
Post subject:
Quote:
Code: Show/Hide
void definitions(string spanish, string english)
      {
         if (textbox.Text = "aprender");
         {
            labeldef.Text = " aprender means to learn";
         }

first of, don't put semicolons after an 'if' statement. Statements that start a new block with { brackets } usually won't need a semicolon, same goes for 'for' and 'while' statements
Code: Show/Hide
if (condition)
{
}
else
{
}
for(int i = 0; i < n ; i++)
{
}
while (condition)
{
}


Also, don't confuse '=' and '=='
'=' assigns a value, and '==' compares two values.
Using '=' will also return a value, but it returns the value that was assigned... or something like that... might depend on data type. But it will not return 'true' or 'false'.

Code: Show/Hide
void definitions(string spanish, string english)
      {
         if (textbox.Text == "aprender")
         {
            labeldef.Text = " aprender means to learn";
         }



also, unlike C, you don't have to add definitions for every method or functions in C#. The compiler will consider the header of the method when you define it as the declaration.
Code: Show/Hide
void ButtonClick(object sender, EventArgs e)
      {
         labeltitle.Text = textbox.Text;
         toolStripStatusLabel.Text = "Finding Definition...";
         void definitions(aprender, english);

So here, you don't 'declare' your 'definitions()' method, you just need to call it. Which means you don't need to have any type in front of it.
Code: Show/Hide
void ButtonClick(object sender, EventArgs e)
      {
         labeltitle.Text = textbox.Text;
         toolStripStatusLabel.Text = "Finding Definition...";
         definitions(aprender, english);

All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group