Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/153.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
read&;从文件写入 我想用C++编写一个程序,提示用户输入一个已有文件的文件名,其中每个记录的长度是12个字符,其中包含10个记录。接下来,程序查找第6条记录的开头,读取文件中的记录,并将它们附加到包含3条记录的现有输出文件的末尾。 谢谢。_C++_File - Fatal编程技术网

read&;从文件写入 我想用C++编写一个程序,提示用户输入一个已有文件的文件名,其中每个记录的长度是12个字符,其中包含10个记录。接下来,程序查找第6条记录的开头,读取文件中的记录,并将它们附加到包含3条记录的现有输出文件的末尾。 谢谢。

read&;从文件写入 我想用C++编写一个程序,提示用户输入一个已有文件的文件名,其中每个记录的长度是12个字符,其中包含10个记录。接下来,程序查找第6条记录的开头,读取文件中的记录,并将它们附加到包含3条记录的现有输出文件的末尾。 谢谢。,c++,file,C++,File,您可能会发现以下内容很有用: #include <iostream> #include "McDonaldsApplication.h" int main() { McDonaldsApplication app; string name, dob, pos, ssn; std::cout << "Enter your name: " << std::endl; std::cin >> name; std::cout <

您可能会发现以下内容很有用:

#include <iostream>
#include "McDonaldsApplication.h" 

int main()
{
  McDonaldsApplication app;
  string name, dob, pos, ssn;
  std::cout << "Enter your name: " << std::endl;
  std::cin >> name;
  std::cout << "Enter your DOB: " << std::endl;
  std::cin >> dob;
  std::cout << "Enter your SSN: "  << std::endl;
  std::cin >> ssn;
  std::cout << "Enter your desired position (0,1,2): " << std::endl;
  std::cin >> pos;
  std::cout << "Thank you! Your application is being submitted now\n";
  app.setName(name);
  app.setDob(dob);
  app.setSsn(ssn);
  app.setPos(pos);
  app.submit();
}
#包括
#包括“McDonaldsApplication.h”
int main()
{
麦当劳应用程序;
字符串名称、dob、pos、ssn;
std::cout名称;
std::cout-dob;
std::coutssn;
std::cout pos;

std::cout因为你实际上没有问问题(问题以“?”结尾),所以我将用我选择的语言发布一个半相关的实现,来说明你的意思

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace TestConsole
{
 class Program
 {
  /// <summary>
  /// http://www.mcdonalds.com/us/en/careers.html
  /// </summary>
  /// <param name="args"></param>
  static void Main(string[] args)
  {
   using (StreamWriter writer = new StreamWriter("c:\\mcdonalds_app.txt"))
   {
    writer.WriteLine("Hello, my name is {0}. I'd love to work here!", args[0]);
    writer.Close();
   }
  }
 }
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.IO;
命名空间测试控制台
{
班级计划
{
/// 
/// http://www.mcdonalds.com/us/en/careers.html
/// 
/// 
静态void Main(字符串[]参数)
{
使用(StreamWriter=newstreamwriter(“c:\\mcdonalds\u app.txt”))
{
WriteLine(“你好,我的名字是{0},我很想在这里工作!”,args[0]);
writer.Close();
}
}
}
}

有问题吗?这只是你想做什么的陈述。听起来很酷!这是家庭作业吗?好的。你哪里有问题?任何问题都会涉及如何执行这样的基本I/O。请将“我想”改为“我的教授想我”.如果你自己都不解决这个问题,没有人会帮你做这项工作或给你帮助。让我们看看你已经做了什么。