Question
store different type of value in an 2d array using getline. however, there is an error.. the error message is error: no matching function
however, there is an error..
the error message is \" error: no matching function for call to getline(std::istream&, double&, char)\"
below is the whole error message..
pj2.cpp: In function int main(): pj2.cpp:37:59: error: no matching function for call to getline(std::istream&, double&, char) pj2.cpp:37:59: note: candidates are: /usr/include/c++/4.6/bits/basic_string.tcc:1070:5: note: template std::basic_istream& std::getline(std::basic_istream&, std::basic_string&, _CharT) /usr/include/c++/4.6/bits/basic_string.h:2734:5: note: template std::basic_istream& std::getline(std::basic_istream&, std::basic_string&),>,>,>,>,>,>
and then below is my codes....
can someone help me to store without error message?
#include #include
using namespace std;
struct data { string name; double area; int population; double dencity; };
int main() { struct data a; a.name; a.area; a.population; a.dencity; string array[ 3 ][ 4 ]; int i, j; for( i = 0; i { for( j = 0; j => { if( j == 1) { getline( cin, a.area, '|' ); array[ i ][ j ] = a.area; } if( j == 3 ) { getline( cin, a.dencity, '|' ); array[ i ][ j ] = a.dencity; } getline( cin, a.name, '|' ); array[ i ][ j ] = a.name; cout } } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started