i am having this code for read a txt file. which i want to read 3 numbers each line, first two is two nodes and the second is the length of two nodes, for example 1 2 10 which means from nodes 1 to nodes 2 the length is 10. Please help me find out which part is wrong for my code?View more random threads:
- Regarding variable declaration, i know about interger types
- Consitional Operator in C++ July 2011
- Argc(argument count) and argv(argument value) are used in...
- differetiate between shallow copy and copy constructor in...
- Declaration are Definition are the function in c++ May 2011
- C++ Guessing Game include Number and ABC
- Wht is the use of Inheritnce in OOP?
- array project code c++ 2011
- Pointer question??
- Pass string value into function as an array in c++
#include <iostream>
#include <fstream>
using namespace std;
Sponsored Links
int main()
{
int c[100][100];
int p, q, len;
ifstream fin;
fin.open("filename.txt")
for(int i=1; i<=3; ++i)
for(int j=1; j<=3; ++j)
c[i][j] = 99999;
for(int i=1; i<=3; ++i)
{
fin >> p >> q >> len;
c[p][q] = len;
c[q][p] = len;
}
fin.close();
}
just try to compile it and check it is working or not.
Urgent call: 03455242488. | Virtual University Assignments
Virtual University GDBs | Virtual University Papers | Vu Projects | Vu Handouts
About Expert
There are currently 1 users browsing this thread. (0 members and 1 guests)