Results 1 to 5 of 5
  1. #1

    Default Turbo C++ Text input, file output.


    Guyz need help.

    Tungod sa ka edaran na nako nakalimtan na nako ang programming, gi taya na dyud ang utok nako.

    Scenario: gusto unta ko mag buhat ug program sa C++ para email account creator nako, para ni sa akong online game nga gi duwaan.

    For example:

    Input any string:
    Input the number of account:
    sample email kay wakeks1@yahoo.com

    username (string) kay wakeks1

    so if input nako number of account is 300, mag start na siya ug 1 to 300.

    mao rani ma hinumduman nako.

    nstring = dire e store ang string
    nacc= dire e store ang number of accounts.
    mail= @yahoo.com mao na ang prefix sa username

    cin >> nstring;
    cin >> nacc;

    cout << "Input any strings: \n";
    cin >> nstring;
    cout << "Input number of accounts: \n";
    cin >> nacc;

    for ( i = 0; i < nacc; i++ )

    ambot saon ni pag buhat

    gyut199 gyut199@gmail.com

    cout << nstringnacc nstringnaccmail


    .txt file output contents
    Thank you guys.

  2. #2
    Nah gitaya napud ko sa C++ kani try ni sya ang blema walay output text file hahahaha, ignore nalang na cin<<acc; sa last kay gi butang lang nako para ma pause.

    #include <iostream.h>
    #include <string.h>
    #include <conio.h>

    int main()
    {
    int i, acc;
    char name [50], email [50];
    clrscr();

    cout<< "Username: "; cin>> name;
    cout<< "Number of accounts: "; cin>> acc;
    cout<< "Email address: "; cin>> email;

    for (i=1;i<acc;i++){
    cout<<name<<i<<email<<endl;
    }

    cout<< "\nAccount Creation Done!";
    cin>> acc;
    return 0;
    }

  3. #3
    Diara na human na dyud nako.

    Code:
    #include <iostream.h>
    #include <string.h>
    #include <conio.h>
    #include <fstream.h>
    
    int main()
    {
        int i, acc;
        char name [50], email [50];
        ofstream myfile;
        clrscr();
    
        cout<< "Username: "; cin>> name;
        cout<< "Number of accounts: "; cin>> acc;
        cout<< "Email address: "; cin>> email;
        myfile.open ("account.txt");
    
        for (i=1;i<acc;i++){
            myfile <<name<<i<<" "<<name<<i<<email<<"\n\n";
        }
    
        cout<< "\nAccount Creation Done!";
        myfile.close();
    return 0;
    }
    Last edited by SmaRkieS; 02-01-2010 at 04:05 PM.

  4. #4
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    remove on "cin>> acc; " before exiting. why not add some modes?

    "w" Create an empty file for writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.
    "a" Append to a file. Writing operations append data at the end of the file. The file is created if it does not exist.
    "r+" Open a file for update both reading and writing. The file must exist.
    "w+" Create an empty file for both reading and writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.
    "a+" Open a file for reading and appending. All writing operations are performed at the end of the file, protecting the previous content to be overwritten. You can reposition (fseek, rewind) the internal pointer to anywhere in the file for reading, but writing operations will move it back to the end of file. The file is created if it does not exist.

  5. #5
    Quote Originally Posted by MarkCuering View Post
    remove on "cin>> acc; " before exiting. why not add some modes?

    "w" Create an empty file for writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.
    "a" Append to a file. Writing operations append data at the end of the file. The file is created if it does not exist.
    "r+" Open a file for update both reading and writing. The file must exist.
    "w+" Create an empty file for both reading and writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.
    "a+" Open a file for reading and appending. All writing operations are performed at the end of the file, protecting the previous content to be overwritten. You can reposition (fseek, rewind) the internal pointer to anywhere in the file for reading, but writing operations will move it back to the end of file. The file is created if it does not exist.
    Bro buhat ug program e post dire, using additional modes.

  6.    Advertisement

Similar Threads

 
  1. Want To Buy: dLINK adaptor sa router ( 220v input 5vdc output )
    By Wenxp7 in forum Computers & Accessories
    Replies: 7
    Last Post: 09-15-2011, 09:32 PM
  2. help na pod sa akong website, No input file specified
    By Rise Clan "flipdruid" in forum Websites & Multimedia
    Replies: 15
    Last Post: 07-17-2010, 02:58 PM
  3. For Sale: Transformer:input=220V output=24v 6A
    By abay_006 in forum Everything Else...
    Replies: 3
    Last Post: 09-24-2009, 09:54 PM
  4. For Sale: IBM AC Adapter For Laptop Input:Autovolt/Output: 16v, 3.36A, Original, Used
    By ioscar in forum Computers & Accessories
    Replies: 0
    Last Post: 08-01-2008, 01:06 PM
  5. Problem with files in Turbo C
    By Lord_Ac in forum Programming
    Replies: 8
    Last Post: 07-04-2007, 06:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top