Thread: Whats wrong with my program?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    156

    Whats wrong with my program?

    The program's purpose is for the user to create a new file name along with the file extension.

    Code:
    #include <iostream>
    #include <fstream.h>
    #include <string>
    
    void Stream(char &file, char &ext, ofstream &create)
    {
     cout << "Type in a filename: ";
      cin >> file;
     cout << "\nType the file extension(ie: txt): ";
      cin >> ext;
     const char *filename=file + "." + ext;
     create.open(filename);
     create.close();
    }
    
    int main(int argc, char *argv[])
    {
     char boob, lama;
     ofstream x;
     Stream(boob, lama, x);
     cout << "\nFile created was: " << boob << "." << lama << endl;
    
     cin.get();
     return 0;
    }
    Last edited by Golden Bunny; 05-23-2002 at 01:53 PM.
    Compiler: MingW(IDE: Bloodshed Dev-C++ 4.01)
    Web Site: Zoo Crew
    Forums: Zoo Boards
    E-mail: [email protected]

    "Do you wanna go to jail or do you wanna go home?!?!" - Alonzo(Training Day)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Maze Program - What am I doing wrong?
    By Gipionocheiyort in forum C++ Programming
    Replies: 20
    Last Post: 08-02-2007, 01:31 PM
  2. Replies: 5
    Last Post: 01-13-2007, 02:14 AM
  3. What is wrong with my code? My first program......
    By coreyt1111 in forum C++ Programming
    Replies: 11
    Last Post: 11-14-2006, 02:03 PM
  4. Whats wrong with this program - Output of a series
    By duffmckagan in forum C Programming
    Replies: 2
    Last Post: 07-26-2006, 09:57 AM
  5. Whats wrong with my program?
    By Ruflano in forum C++ Programming
    Replies: 5
    Last Post: 02-21-2002, 05:09 PM