Search:

Type: Posts; User: ManiacBR

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    1,496

    Problem with loading a file

    I currently have this code for loading the contents of a file in a function,



    void loadfile1()
    {
    string line;

    cout << "File 1 - \n \n";
    ifstream infile("test.txt", ios::in);
  2. Replies
    4
    Views
    1,212

    Yeah it is actually that, just a typo. Thanks...

    Yeah it is actually that, just a typo.

    Thanks guys got it working now.

    Cheers!
  3. Replies
    4
    Views
    1,212

    Probelm when entering a string

    I've got a bit of code working so it will accept the number you put it and use it else where (no need to show you this), but if a string/letter is entered then the program crashes. I'd like it to...
  4. Replies
    2
    Views
    984

    Thanks got it working now. Didn't realise that...

    Thanks got it working now. Didn't realise that would work for a file.
  5. Replies
    2
    Views
    984

    Spaces in files

    Ok i've got my file working for input, but I can't get it to except spaces,



    ofstream outfile("*file name*", ios::out);
    outfile << song[arraynumber].artist;
    outfile <<...
  6. Replies
    3
    Views
    906

    Cheers guys! That's it working now, just had...

    Cheers guys!

    That's it working now, just had to remove the ".h" and add namespace like you said. And yes i am using the free version :)

    Thanks again.
  7. Replies
    3
    Views
    906

    Newbie File input question

    Ok i've just started using files, and I can't get this bit of code to work.



    #include<String.h>
    #include<fstream.h>

    int main( )
    {
    string str(“Hello”);
  8. Replies
    4
    Views
    1,321

    No need I solved the problem!

    No need I solved the problem!
  9. Replies
    4
    Views
    1,321

    Validation loop problem

    Im trying to add validation to my loop so that when there is no entry it comes up with an error. However the program justs skips the loop when it should loop again.




    struct music{
    ...
  10. Replies
    4
    Views
    1,621

    Random numbers problem

    I'm trying to create a random number between 1 and 100, but it keeps coming up with the number 42. I've tried everything to try and fix it but nothing will work.



    #include <iostream>
    #include...
  11. Replies
    5
    Views
    1,193

    Thnaks got it working now.

    Thnaks got it working now.
  12. Replies
    5
    Views
    1,193

    Case statement problem

    I'm completely new to using case statements in C++ so bear with me. I'm trying to do a very simple case statement that will display the user to the user what grade they have got.


    #include...
  13. Replies
    10
    Views
    1,311

    Cheers for that! I see were I was going wrong...

    Cheers for that! I see were I was going wrong now.

    I do know you're meant to put return 0, but like it's been said, it's not essential so I left it out here.
  14. Replies
    10
    Views
    1,311

    Struct Problem

    #include <iostream>
    using namespace std;

    int main()

    {

    int index;

    struct DOB{
  15. Replies
    4
    Views
    1,151

    What's wrong with this code?

    #include <iostream>
    #include <string>
    using namespace std;

    int main()
    {
    string songs[4];
    int song2;
    string song;
    int index;
Results 1 to 15 of 15