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);
Type: Posts; User: ManiacBR
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);
Yeah it is actually that, just a typo.
Thanks guys got it working now.
Cheers!
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...
Thanks got it working now. Didn't realise that would work for a file.
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 <<...
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.
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”);
No need I solved the 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{
...
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...
Thnaks got it working now.
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...
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.
#include <iostream>
using namespace std;
int main()
{
int index;
struct DOB{
#include <iostream>
#include <string>
using namespace std;
int main()
{
string songs[4];
int song2;
string song;
int index;