yes i know that's why i am asking a solution for that.
Farhan_Karim
Posts
-
Input multiple data types from a file into a linked list -
Input multiple data types from a file into a linked listi am working on a movie database and i have output from my file that i want to load into my linked list,no problem opening file but when i run this function it enters junk values in the list and only works if i enter all the strings without spaces or seperated by special characters. i am reading this from the txt file SHAWSHANK REDEMPTION 120 5 MYSTERY 2009 ENGLISH 3 THE MATRIX 120 5 MYSTERY 2009 ENGLISH 3 THE MATRIX PART1 120 5 MYSTERY 2009 ENGLISH 3 THE MATRIX PART2 120 5 MYSTERY 2009 ENGLISH 3 this is the code for load text from file into a linkedlist(doubly)
void double_llist::loadfromfile(){
string mname,mgenre,mlanguage; int mrelease\_year,mamount, mrating,mruntime; ifstream fromfile; fromfile.open("database.txt"); while (fromfile >> mname >> mgenre >> mlanguage >> mrelease\_year>>mamount>>mrating>>mruntime) { /\* do something with name, var1 etc. \*/ cout << mname<
the code for doublylinkedlist
void double_llist::create_list(string mname,
string mgenre,
string mlanguage,
int mrelease_year,
int mamount,
int mrating,int mruntime)
{struct node \*s, \*temp; temp = new(struct node); temp->info=id++; temp->name = mname; temp->genre=mgenre; temp->language=mlanguage; temp->release\_year=mrelease\_year; temp->amount=mamount; temp->rating=mrating; temp->runtime=mruntime; temp->next = NULL; if (start == NULL) { temp->prev = NULL; start = temp; } else { s = start; while (s->next != NULL) s = s->next; s->next = temp; temp->prev = s; }
}
my class and node struct for linkedlist
#include
#include
#include
#include
#include
/*
* Node Declaration
*/
using namespace std;
struct node
{
int info;
string name;
string genre;
string language;
int release_year;
int amount;
int rating;
int runtime;
struct node *next;
struct node *prev;
static int counter;
}*start;
int id=1;
/*
Class Declaration
*/
class double_llist
{
public:void create\_list(string mname, string mgenre, string mlanguage, int mrelease\_y
-
Getting forward from console applications to guiOk,Thanks :)
-
Getting forward from console applications to guiHi,I recently completed the book Sams Teach yourself C++ and this website was mentioned there for help in further programming process I want some suggestions about getting started with programming in GUI,i am fed up of using console for 3 years learning c and c++ ;P