Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 对getline()的调用没有匹配的函数?_C++_Macos_Getline - Fatal编程技术网

C++ 对getline()的调用没有匹配的函数?

C++ 对getline()的调用没有匹配的函数?,c++,macos,getline,C++,Macos,Getline,每次我试图构建这段代码时都会出错 “对getline()的调用没有匹配的函数” 但我以前用过,效果很好?我不知道发生了什么事。我正在使用Mavericks OSX,如果有什么用的话,并使用Xcode来构建这个项目。是给学校的。我知道inputFile工作正常,因为我已经对getline()和打印到控制台的“Open”进行了注释 // // main.cpp // Project 4 // // Created by Eric Diviney on 10/27/13. // Copyrig

每次我试图构建这段代码时都会出错

“对getline()的调用没有匹配的函数”

但我以前用过,效果很好?我不知道发生了什么事。我正在使用Mavericks OSX,如果有什么用的话,并使用Xcode来构建这个项目。是给学校的。我知道inputFile工作正常,因为我已经对getline()和打印到控制台的“Open”进行了注释

//
//  main.cpp
//  Project 4
//
//  Created by Eric Diviney on 10/27/13.
//  Copyright (c) 2013 Eric Diviney. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;

int main()
{
    /*
    |
    |-------------------------------------------------------------
    |   Documentation
    |-------------------------------------------------------------
    |   The headings[] array will contain all strings for the customer's receipt.
    |   the 2nd level of headings[][] will contain all of the info (name, address etc.) while
    |   the first level of headings[] will contain the number of customers. The order of the second level is heading1, heading2, customername,
    |   address, phone, footer
    |
    |   The charges[] array will contain all double/floats required to compute the charges for the customer.
    |   The third level of charges[][][] will contain the actual charges/prices while the first level
    |   will hold n amount of customers. The second level of that array (charges[][]) will hold the first, second and third month.
    |   The order of the last array is electricity, water, and gas
    |
    |   The output[] array is 3 customers in the first level (output[]) and the correspnding strings for each
    |   segment of their receipt output[][]. The order in the second level of this array is heading1, heading2, customerName, Customer address, 
    |   customer Phone, Customer ID, electricity, water, gas, subtotal, discountRate, taxRate, tax for order, discount for order, order total,
    |   footer
    |
     */

    // variable declarations
    string headings[3][7];
    double charges[3][3][3];
    string output[3][16];

    ifstream inputFile;
    inputFile.open("/Users/ericdiviney/Documents/workspace/project4/project4/input.txt");
    if(inputFile.is_open())
    {
        cout << "Open" << endl;
    }

    getline(inputFile, headings[0][0], "*");
    //cout << headings[0][0];

  return 0;
}
//
//main.cpp
//项目4
//
//埃里克·迪维尼于2013年10月27日创作。
//版权所有(c)2013埃里克·迪维尼。版权所有。
//
#包括
#包括
#包括
#包括
使用名称空间std;
int main()
{
/*
|
|-------------------------------------------------------------
|文件
|-------------------------------------------------------------
|标题[]数组将包含客户收据的所有字符串。
|第二级标题[]将包含所有信息(姓名、地址等),同时
|标题[]的第一级将包含客户数量。第二级的顺序是heading1,heading2,customername,
|地址、电话、页脚
|
|charges[]数组将包含为客户计算费用所需的所有double/float。
|第三级费用[]将包含实际费用/价格,而第一级费用
|将容纳n个数量的客户。该阵列的第二级(费用[][])将容纳第一个月、第二个月和第三个月的客户。
|最后一个数组的顺序是电、水和气
|
|output[]数组是第一级(output[])中的3个客户,每个客户对应的字符串
|其收据输出的段[][]。此数组第二级中的订单为heading1、heading2、customerName、Customer address、,
|客户电话、客户ID、电、水、气、小计、折扣、税率、订单税、订单折扣、订单总额、,
|页脚
|
*/
//变量声明
字符串标题[3][7];
双重收费[3][3][3];
字符串输出[3][16];
ifstream输入文件;
open(“/Users/ericdiviney/Documents/workspace/project4/project4/input.txt”);
if(inputFile.is_open())
{

cout第三个参数是单个字符,因此需要

getline(inputFile, headings[0][0], '*');

请注意单引号。
“*”
是以null结尾的字符串文字,类型为
常量字符[2]

第三个参数是单个字符,因此需要

getline(inputFile, headings[0][0], '*');

请注意单引号。
“*”
是以null结尾的字符串文字,类型为
常量字符[2]

你,我的朋友,是活着的最伟大的人。谢谢你!哈哈,我会在这11分钟限制的事情结束后勾选答案。非常感谢你!!你,我的朋友,是活着的最伟大的人。谢谢你!哈哈,我会在这11分钟限制的事情结束后勾选答案。非常感谢你H