TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Aman Agarwal
NA
1
805
convert from c++ to c# code
Sep 14 2016 3:39 PM
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
using namespace std;
struct node
{
string stock_code;
string stock_name;
double amt_invested;
int shares_held;
double current_price;
struct node *next;
struct node *prev;
};
int main()
{
ifstream infile("input.txt");
string sc,sn;
double ai,cp;
int sh;
int flag = 0;
struct node* head1 = NULL;
struct node* head2 = NULL;
while (infile >> sc >> sn >> ai >> sh >> cp)
{
// cout << sc << " " << sn << " " << ai << " " << sh << " " << cp << endl;
if(flag == 0)
{
struct node* temp = (struct node*)malloc(sizeof(struct node));
temp->stock_code = sc;
temp->stock_name = sn;
temp->amt_invested = ai;
temp->shares_held = sh;
temp->current_price = cp;
//cout << "ho" << endl;
temp->prev = NULL;
temp->next = NULL;
head1 = temp;
temp = (struct node*)malloc(sizeof(struct node));
temp->stock_code = sc;
temp->stock_name = sn;
temp->amt_invested = ai;
temp->shares_held = sh;
temp->current_price = cp;
temp->prev = NULL;
temp->next = NULL;
head2 = temp;
flag++;
}
temp->prev = NULL;
temp->next = NULL;
head1 = temp;
temp = (struct node*)malloc(sizeof(struct node));
temp->stock_code = sc;
temp->stock_name = sn;
temp->amt_invested = ai;
temp->shares_held = sh;
temp->current_price = cp;
temp->prev = NULL;
temp->next = NULL;
head2 = temp;
flag++;
}
}
}
Reply
Answers (
2
)
create a List of list
how to convert object to json and json to object?