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.
+5
A:
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();
}
turdfurguson
2010-10-15 20:09:06
+2
A:
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
2010-10-15 20:15:25