cant get the output pls help

i am getting a blank out put on this program i dont know why t got these massage when i go debbuging.


'computerprogrammin13.exe': Loaded 'C:\Users\neha\Documents\Visual Studio 2010\Projects\computerprogrammin13\Debug\computerprogrammin13.exe', Symbols loaded.
'computerprogrammin13.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'computerprogrammin13.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'computerprogrammin13.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'computerprogrammin13.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'computerprogrammin13.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
The program '[6572] computerprogrammin13.exe: Native' has exited with code 0 (0x0).






this is my code that i write i dont kn ow what i did was wrong






#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{
string firstname, middlename , lastname;
string line;
ifstream infile;
ofstream outfile;
infile.open("input.txt");
outfile.open("output.txt");

while(getline(infile,line))
{
int comma = line.find(',');
int length = line.length();


lastname = line.substr(0,comma);

int space_after_firstname = line.find(' ',comma+2);

if(space_after_firstname != -1)
{
firstname = line.substr(comma+2,
space_after_firstname-comma-2);

middlename =line.substr
(space_after_firstname+1,length);
outfile<<firstname<<"jason"<<middlename<<"brain";
outfile<<firstname<<"lisa"<<middlename<<"maria";
outfile<<firstname<<"anil"<<middlename<<"kumar";
outfile<<firstname<<"sumit"<<middlename<<"sahil";
outfile<<firstname<<"rhonda"<<middlename<<"beth";
}
else
{
firstname = line.substr(comma+2,length);
outfile<<firstname<<"jason";
outfile<<firstname<<"lisa";
outfile<<firstname<<"anil";
outfile<<firstname<<"sumit";
outfile<<firstname<<"rhonda";
}
outfile<<lastname<<"miller"<<endl;
outfile<<lastname<<"blair"<<endl;
outfile<<lastname<<"gupta"<<endl;
outfile<<lastname<<"arora"<<endl;
outfile<<lastname<<"saleh"<<endl;

}


return 0;
}
It just cannot find a few program database files that aren't strictly related to your program.

Your program actually runs fine; it has an exit code of 0.

Edit: If you're looking for console output there won't be any. If you want to output to the console, you need to use the cout command. Does your output file get created?
Last edited on
so i change my outputfile<<" ";
to cout<<" ";
but still no output at all
than means it is not finding the file, try finding the absolute path for the file.
example
/Users/home/Desktop/projects/filename.filetype
i find the file but when i open it it do the same ,, i have a question if i send this .cpp file to my teacher can she be able to look the output i try every thing theri is no error but i am not getting output
do want i suggested.
i know were the file is located so what i do next ??????????????
i am so confused right now
filename.open("/Users/home/Desktop/projects/filename.filetype");

did you do that?
I am a lil confuse wrt that if condition with the factorial but what is meant by including the entire path is to find the location copy and paste what you see at the top of the address bar and put a / then your file name.
As ui uiho pointed out it should look like this /Users/home/Desktop/projects/filename.filetype

Next inside your loop use this line

cout<<line<<endl;

to read the infile
ok this my code after i change the ouputfile and infile


#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{
string firstname, middlename , lastname;
string line;
ifstream infile;
ofstream outfile;
infile.open("computerprogrammin13.txt");
outfile.open("computerprogrammin13.txt");

while(getline(infile,line))
{
int comma = line.find(',');
int length = line.length();


lastname = line.substr(0,comma);

int space_after_firstname = line.find(' ',comma+2);
cout<<line<<endl;

if(space_after_firstname != -1)
{
firstname = line.substr(comma+2,
space_after_firstname-comma-2);

middlename =line.substr
(space_after_firstname+1,length);
outfile<<firstname<<"jason"<<middlename<<"brain";
outfile<<firstname<<"lisa"<<middlename<<"maria";
outfile<<firstname<<"anil"<<middlename<<"kumar";
outfile<<firstname<<"sumit"<<middlename<<"sahil";
outfile<<firstname<<"rhonda"<<middlename<<"beth";
}
else
{
firstname = line.substr(comma+2,length);
outfile<<firstname<<"jason";
outfile<<firstname<<"lisa";
outfile<<firstname<<"anil";
outfile<<firstname<<"sumit";
outfile<<firstname<<"rhonda";
}
outfile<<lastname<<"miller"<<endl;
outfile<<lastname<<"blair"<<endl;
outfile<<lastname<<"gupta"<<endl;
outfile<<lastname<<"arora"<<endl;
outfile<<lastname<<"saleh"<<endl;

}


return 0;
}

still no output

'computerprogrammin13.exe': Loaded 'C:\Users\neha\Documents\Visual Studio 2010\Projects\computerprogrammin13\Debug\computerprogrammin13.exe', Symbols loaded.
'computerprogrammin13.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'computerprogrammin13.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'computerprogrammin13.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'computerprogrammin13.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'computerprogrammin13.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
The program '[1556] computerprogrammin13.exe: Native' has exited with code 0 (0x0).


get this when i debug it
and i also try to put all of the folderpath
i get the same debug answer
when you allocate a file the compiler searches for a file relative to the location of the programs location. sometimes the compiler looks in the wrong location or the program gets moved away from the original file location. including the full file path(absolute location) tells the compiler EXACTLY where to locate the file. remember that if a file is not allocated the compiler is placing the pointer somewhere in your RAM, and you will not be able to get any information form the file. if you include the absolute location then the only possible way for the file pointer to be pointing to nothing is if the file does NOT exist. if you only include the relative path there are several possibilities on why the correct file is not being allocated. so i am telling you to use the absolute path because if that does not work the file must not exist or your compiler cannot access files.
I see you still haven't taken ui uiho advice.
Let me help you.
Copy the file from where ever it is and place it in your My Documents.
Next replace the 5th line in your main which says infile.open("computerprogrammin13.txt");
with
infile.open("C:\Users\System User\Documents\computerprogrammin13.txt");
it should work hopefully

All the best
Topic archived. No new replies allowed.