save to notepad

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string *words;
    int x,ctr;
    words=new string [x];
    
    cout<<"Enter number of words to input: ";
    cin>>x;
    
    for(ctr=0;ctr<x;ctr++)
        {
            cout<<"Enter word number "<< (ctr+1)<<" : ";
            cin>>words[ctr];    
        }
    system("PAUSE");
    return 0;
}


Hi!,can you please help me guys on how to save those string that I input in notepad. I have no idea what codes to use, any help or links will do!
I have no idea what you mean by "save those string that I input in notepad".
But you have an error in your code there, in line 9
 
words= new string [x];


You use x even though you never assigned a value to it. Just put that line after cin>>x.

For that "save to notepad" thing- sounds as if you were trying to write a textfile (notepad is a program for displaying text files... you can't save something to a program).

This may help you: http://www.cplusplus.com/doc/tutorial/files/
Topic archived. No new replies allowed.