Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

store different type of value in an 2d array using getline. however, there is an error.. the error message is error: no matching function

store different type of value in an 2d array using getline.

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

Find the value of each expression if x = 2 and y = -1. -3x -1 y

Answered: 1 week ago

Question

Focus on the interview.

Answered: 1 week ago

Question

4. Determine the significance of an F-ratio test statistic.

Answered: 1 week ago

Question

If alpha were changed to .01, would our final decision change?

Answered: 1 week ago