Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8277061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:34:44+00:00 2026-06-08T08:34:44+00:00

#include <fstream> #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; typedef

  • 0
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>


using namespace std;

typedef vector <double> record_t;
typedef vector <record_t> data_t;


int sorted(int *data,int max_record_size)
{


}




int main()
{
    // Here is the data we want.
    data_t data;

    // Here is the file containing the data. Read it into data.
    ifstream infile( "sort.txt" );
    infile >> data;

    // Complain if something went wrong.
    if (!infile.eof())
    {
        cout << "Fooey!\n";
        return 1;
    }

    infile.close();

    // Otherwise, list some basic information about the file.
    cout << "Your CSV file contains " << data.size() << " records.\n";



    unsigned max_record_size = 0;
    for (unsigned n = 0; n < data.size(); n++)
        if (max_record_size < data[ n ].size())
            max_record_size = data[ n ].size();
    cout << "The largest record has " << max_record_size << " fields.\n";
    int i;
    for (i=0; i <= max_record_size; i++)
    {

        cout << "your data contains " << data[ 0 ][ i ] << ".\n";
        int temp[max_record_size];

        sorted(&data,max_record_size);

        //cout << "Your sorted data contains" << sorted [0] [i] << ".\n";
    }


    cout << "Good bye!\n";
    system("PAUSE");

    return 0;
}

cannot convert data_t*' toint*’ for argument 1' toint
sorted(int*, int)’

Im trying to pass the pointer of my data which should be an array containing my list of numbers to my sort function what exactly am I doing wrong and can you please explain in detail so I can understand it, thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:34:46+00:00Added an answer on June 8, 2026 at 8:34 am

    You don’t have an array. An array in C (or C++) would be just a list of integers, and you could pass it like you did.

    However, you have a vector (and I’m guessing record_t ends up being an int). vector<>s behave a lot like arrays, but they are not, they are actual objects.

    What you probably want to do is write your function as

    int sorted(data_t& data, int max_record_size)
    

    and your call simply as

    sorted(data,max_record_size);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <string> using namespace std; int
#include <iostream> #include <string> #include <fstream> using namespace std ; string strWord( int index
#include<iostream> #include<time.h> #include<list> #include<stdlib.h> #include<fstream> using namespace std; typedef struct diskBtNode { int parent;
Here's my code so far: #include<iostream> #include<string> #include<fstream> using namespace std; int main() {
#include<iostream> #include<fstream> #include<cstdlib> #include<iomanip> using namespace std; int main() { ifstream in_stream; // reads
#include <iostream> #include <fstream> using namespace std; int main () { ofstream myfile; myfile.open
I created this program: #include <iostream> #include <fstream> using namespace std; int main ()
Here is my code: #include <iostream> #include <stdlib.h> #include <fstream> using namespace std; int
Given this code: #include <iostream> #include <vector> #include <fstream> #include <sstream> #include <boost/regex.hpp> using
Given such a code segment: #include <iostream> #include <iterator> #include <fstream> #include <string> using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.