Search Result

Collapse
6 results in 0.0015 seconds.
Keywords
Members
Tags
cpp
  •  

  • What kinda error is this 'UnfairDivision::albertsShare' : must return a value

    I got this error message:

    Error 2 error C4716: 'UnfairDivision ::functionName' : must return a value d:\work\tc\tc\c ode.cpp 30

    Why this error happens. Please help. I'm trying to use accumulate() of stl.

    Code:
    int sum = accumulate(assets.begin(), assets.end(), 0);
    Thanks in advance.
    See more | Go to post

  • kino
    started a topic How to read from a text file?
    in C

    How to read from a text file?

    Hello,

    I am supposed to read from a text file a series of numbers and then store them in a struct array.

    Here's my code:

    Code:
    int main()
    {
        ifstream In;
        string folder, filename, name2, line;
        int i = 0;
        
        cout << endl << "Enter the name of the folder" << endl;
         cout << "Follow the format: c:/your_folder_name/
    ...
    See more | Go to post

  • kino
    started a topic Why is first line of file not read in properly?
    in C

    Why is first line of file not read in properly?

    I am using this function to get data from a file

    Code:
    void get()
    {
           string line;
           ifstream myfile;
           myfile.open ("jty.txt");
       
       while (getline(myfile, line))
       {  
              myfile >> one[i].a >> one[i].b >> one[i].c;
             i++;
       }
       
       
       myfile.close();
    }
    where...
    See more | Go to post

  • How to fix error: "request for member which is of non-class type"?

    Hello,

    I am getting the following error

    25 C:\Dev-Cpp\main.cpp request for member `no' in `one', which is of non-class type `box[12]'


    in the code

    Code:
    while (!myfile.eof())
       {
      
       for(int i=0;i<12;i++)
       {              
        myfile>>one.no[i];           
       }
       
       }
    where 'one' is an object of struct type 'box' and 'no' is...
    See more | Go to post

  • solita
    started a topic Doubt regarding extern usage
    in C

    Doubt regarding extern usage

    Will this compile? I have 1 header file , and it is included in 2 source files.
    1. What about re-declaration error ? (for arraysize... )
    2. #include always = textual substitution ??? Or does it have some intelligence ?

    my header file - consts.h:
    const int arraysize = 15;

    my sources file 1 - op1.cpp:

    #include "consts.h"
    char array1[arraysize];

    my source...
    See more | Go to post

  • bioniclekid8
    started a topic File I/O question in C++
    in C

    File I/O question in C++

    How would I make my program say something if it doesn't see the file when it attempts to open it?
    See more | Go to post
Working...