I want to write a program in c++ that prompts a user for a file name of an existing file that contains 10 records where the length of each record is 12 characters. next the program seeks to the beginning of the 6th record, reads the records in the file and append them to the end of an existing output file that contains 3 records. Thank you.
Asked
Active
Viewed 344 times
-2
-
2Is there a question? That is just a statement of what you want to do. – Amardeep AC9MF Oct 15 '10 at 20:00
-
7Sounds like a cool idea! – Alex Oct 15 '10 at 20:01
-
Is this for an homework? – Etienne de Martel Oct 15 '10 at 20:01
-
1Ok. Where are you having trouble? Any [good introductory C++ book](http://stackoverflow.com/questions/388242/the-definitive-c++-book-guide-and-list) will cover how to perform basic I/O like this. – James McNellis Oct 15 '10 at 20:01
-
5Please change "I want to" to "My professor wants me to". Nobody on SO will do the work for you or give you help if you didn't even cope with the problem yourself. Show us what you have already. – AndiDog Oct 15 '10 at 20:01
2 Answers
6
You may find this useful:
#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();
}

matt_h
- 1,289
- 14
- 17
2
Since you didn't actually ask a question (questions end in a '?') I'll post a semi-related implementation of what you may have meant, in a language of my choice.
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();
}
}
}
}

Alex
- 3,644
- 2
- 19
- 27