c Problem: The name does not exist in the class or namespace

Updated on science 2024-02-09
8 answers
  1. Anonymous users2024-02-05

    Runs correctly after modification.

    The problem is that the main function is also a member function of the class, and the local variables defined in the member function cannot be used by other member functions.

    Criticism and correction are welcome if there is something wrong.

    using system;

    namespace hhxxdry

    public class e

    Changed: private static double count, e;

    public static void main(string args)

    int k;

    double t = new double[100];

    t[0] = ;

    e = ;count = 0;

    for (k = 0; k <= 20; k++)t[k + 1] = t[k] / k + 1;

    The value of t is:", k + 1, t[k + 1]);

    count++;

    e = e + 1 / t[k + 1];

    e aa = new e();

    public e()

    The value of e is", e);

    1/k!The value of is", count);

  2. Anonymous users2024-02-04

    Since the constructor of the class is executed first.

    public e()

    The value of e is",e);

    1/k!The value of is",count);

    In this case, the e and count are of course undefined variables.

    Can be modified to:

    public class e

    private double count;

    private double e;

    Replace double count,e; Define the member variables of the class.

  3. Anonymous users2024-02-03

    public e()

    The value of e is",e);

    1/k!The value of is",count);

    Here's the construct, if you're going to use e in it

    Then the e must be defined in the class, not in the main method.

  4. Anonymous users2024-02-02

    e and count are local variables defined in the main function, which of course are not accessible in .

  5. Anonymous users2024-02-01

    Agree with the ground floor.

    lz, how can the variables you define in the main function be accessed in other functions?

  6. Anonymous users2024-01-31

    Both issues are the same as the absence of declarations.

  7. Anonymous users2024-01-30

    First of all, I will explain to you what is using

    The usage rules for using as an introduction to namespace directives are:

    using namespace;

    At. In .NET programs, the most common ** is to introduce the system namespace at the beginning of the program file, the reason for which is that the system namespace encapsulates many of the most basic and common operations, and the following ** is the most familiar to us:

    using system;

    This allows us to use the type in the namespace directly in the program without having to specify a detailed type name. using directives to access nested namespaces.

    About: Namespaces.

    The namespace is. The logical organization of a .NET program, rather than the actual physical structure, is a way to avoid class name conflicts, and is used to divide different data types in combination. For example, in.

    Many of the basic types in .net are located in the system namespace, and the data operation types are located in the namespace, okLet's go on. The question you asked is:

    using requires a reference to the dll

    You do an experiment. Create a new project in your solution. A class library project.

    When you don't quote him. The using statement is also unusable. Right?

    References must be added before you can use any namespace in your library.

    According to the above two scenarios. It's obvious to know. c Medium. All DLL files are decoupled from your project.

    Your project is also a separate namespace. There is no necessary connection between DLLs and DLLs.

    Even if you look at it at the level of simply knocking on the **.

    Just enter this to do. But when you create a new WinForm program.; It can't be used. The reason for this is: vs automatically referenced some dlls for you

    Because there is a decoupling between DLLs and DLLs. There is no connection. So when you want to use a certain namespace. You have to reference the dll of that namespaceOtherwise, it is not possible to find the specific correspondence. Unable to quote correctly.

  8. Anonymous users2024-01-29

    C references are not like C++ and other languages that can be used to include directly, C references you must add a reference to the dll before you can call the dll in the class

Related questions
7 answers2024-02-09

Trademark and application channels: You can go to the registration hall of the Trademark Office (Beijing) in person, or you can entrust a trademark ** agency to handle it. Documents required for application: >>>More

5 answers2024-02-09

I don't know exactly what the other two friends mean, but it seems that they are all based on the flow of discussions. >>>More

4 answers2024-02-09

#include

using namespace std; >>>More

16 answers2024-02-09

The output of this program is: 4

You can standardize the program to make it easier to understand. >>>More

9 answers2024-02-09

Scope. You static char *chh;

static char *ch1;Although the address pointed to by the two pointers does not change, have you ever wondered whether the memory address they point to has been released, char chc[10]; It's local, the function is out, the lifecycle is over, and you're trying to access it with a pointer in void times(). >>>More