129 Archived Topics

Remove Filter
Member Avatar for nitin1

Main.cpp #include <iostream.h> #include "functions.h" int main(){ print_hello(); cout << endl; cout << "The factorial of 5 is " << factorial(5) << endl; return 0; } hello.cpp #include <iostream.h> #include "functions.h" void print_hello(){ cout << "Hello World!"; } factorial.cpp #include "functions.h" int factorial(int n){ if(n!=1){ return(n * factorial(n-1)); } else …

Member Avatar for L7Sqr
0
136
Member Avatar for nitin1

I have considered 3 laptops till now: first is: i5 4th gen/ 4GB RAM/ 500GB hard disk/ 1 GB graphic /Windows 8/ 45k INR Second: i5 4th gen/ 4GB RAM/ 1TB hard disk/ no dedicated graphic/Ubuntu/ 41k INR Third is: i5 4th gen/ 6GB RAM/ 1TB hard disk/ 2 GB …

Member Avatar for Hiroshe
0
352
Member Avatar for nitin1

I am new to parsers. I want to extract/parse the HTML documents. I have heard of this HTML DOM using PHP. Can ypu tell me some links or some basic introduction to start with? How can I use it to extract info from HTML document? Thanks in advance.

Member Avatar for veedeoo
0
258
Member Avatar for nitin1

Actually, I am working on a project. I want to extract all the reviews from a website which has reviews related to movies, for example. I want to make an automated system which can extract the content of the website and save it to a file. That will be my …

Member Avatar for Suzie999
0
128
Member Avatar for nitin1

hi, Can anyone suggest me the approach for finding the lcm of the n numbers? my approach: find the max of the n numbers and start dividing it by all numbers , if all are dividing it then print it, else take next multiple of the max number and repaet …

Member Avatar for ShapesInClouds
0
3K
Member Avatar for nitin1

hey,today someone asked me one question in my class that what is the fastest way to multiply a number by 7 ? I said yes you can use bit-wise operators. the code which i gave him is : int n=10; // for example n = (n<<3)-n; then he aksed me …

Member Avatar for rubberman
0
261
Member Avatar for nitin1

Is there any alternative for clrscr() and gotoxy in gcc ? I am using system("cls"); to clear screen but it doesn't identify cls as a valid command whereas in cmd cls is working perfectly on windows? can anyone please help ? i am using gcc as my compiler and using …

Member Avatar for deceptikon
0
1K
Member Avatar for nitin1

hello, I have started learning python these days. Although i am following a course on coursera.org for learning it , but that course is going very very slow. Also, I don't know if that course contains all things which is need to build codes in python. I have very good …

Member Avatar for nitin1
0
417
Member Avatar for nitin1

import sys i=0; def func1(i): print "i am in function func1" if i<5: i=i+1 func1(i) else: return return def main(): print "beginnning the function\n" func1(i) print "hello Daniweb" s='aman' print "hahha" main() it is giving me syntax error in print "hahha" statement. WHat is that ? According to me, it …

Member Avatar for nitin1
0
206
Member Avatar for nitin1

Actually, I am working on project and specifications are : * using windows 7 ultimate * using Java language to develop project * using IntelliJ IDE for project now, When i run my project it give me output in the section at the bottom in the IDE itself. But, i …

Member Avatar for JamesCherrill
0
248
Member Avatar for nitin1

I am doing a course in recommender systems on coursera.org. I have got an assignment in that. They have told us to use IntelliJ IDE and Lenskit to use. I am very good at C, C++, but not that well in Java. So finding it difficiult to get up these …

Member Avatar for pritaeas
0
121
Member Avatar for nitin1

my office is solved somehow. i don't know how i have done that. one more arises now. that when i click on say "micosoft powerpoint", then it opens calmly and without any problem. but along with that, (after few seconds), confiferation progress starts and then after few minutes , that …

Member Avatar for Greg_z
0
118
Member Avatar for nitin1

If i use macros as functions , then at compilation time , that macros will me be written as function code. so is it better than inline functions and then why don't we use macro always to write the functions as it will speed up our execution. so writing macro …

Member Avatar for sepp2k
0
178
Member Avatar for nitin1

Actually, I have a .csv file which has (userID,movieID,rating) seprated by commas. now, I have to read it and also make another .csv in the output. Can anyone tell me how to read a .csv file and take that data in integer (as userid , rating etc are integers). from …

Member Avatar for deceptikon
0
261
Member Avatar for nitin1

I have a map like this : map<int,map<int,int> > m; in this, I can insert value like a 2-D array. like this, m[i][j]=3; so, now i want to iterate all the values in a particluar row of map. for ex. if m is like this : m["user-id"]["movie-id"], then i want …

Member Avatar for NathanOliver
0
978
Member Avatar for nitin1

how can i keep track of new users to my website. for ex: X is visiting my web-site regularly, so for per week count, i have to count him only once and if Y has visited as new user, then up the count by one. so how can i keep …

Member Avatar for Rahul47
0
159
Member Avatar for nitin1

when i click my any microsoft office's product then it start geetting installing. it is installed from 4-5 years and was wroking fine. it happened 10 days before. now i cant open my word, excel or any other file. when i try to unsitall it , it says "this product …

Member Avatar for ss125
-1
392
Member Avatar for nitin1

#include main() { int ret; ret=fork();ret=fork();ret=fork();ret=fork(); if(!ret) printf("sun"); else printf("solaris"); } how many times sun will be printed and how many times solaris will be printed ? and reason also. i know the fundamentals of fork() but still not able to catch the o/p here. thanks.

Member Avatar for lalitha2294
0
279
Member Avatar for nitin1

int ** foo(int row) { int *arr[100]; for(int i=0;i<10;i++) { arr[i]=malloc(sizeof(int)*10); } int **p=(int**)arr; return p; } what is the problem with this code snippet ? it is not a homework. it is my interview question.

Member Avatar for deceptikon
0
113
Member Avatar for nitin1

class A { public: protected: int i; }; class B : public A { friend void f(A*, B*); void g(A*); }; void f(A* pa, B* pb) { // pa->i = 1; pb->i = 2; // int A::* point_i = &A::i; int A::* point_i2 = &B::i; } void B::g(A* pa) { …

Member Avatar for rubberman
0
146
Member Avatar for nitin1

actually, I was reading C++ from some time , but here i want to learn and imprve my OOPS concepts. IF you have some good links or some e-books or some good book name , please help me here. i have learnt from wiki, my one C book in which …

Member Avatar for soutrik
0
245
Member Avatar for nitin1

I was looking for the find and replace algorithm which editor softwares are using. for ex: notepad. when i search something and then when i replace it , how exactly it works. I am aware of rabin-karp and KMP algos. but i am wondering if they are most efficient ? …

Member Avatar for rubberman
-1
707
Member Avatar for nitin1

my algo : 1.Construct a max(min) heap from first element of all array, 2. extract a max(min) value from the heap and write to output 3. get one more element from array which the value extracted step 2 was in. 4. repeat until heap is not empty can anyone tell …

Member Avatar for rubberman
0
298
Member Avatar for nitin1

int main() { printf("%u %s",&"hello",&"hello"); return 0; } can you please explain that how "hello" is working here ? i know it is string constant ? so it is acting as a pointer to a char like i do char *s= "daniweb"; so, if it is the case, then why …

Member Avatar for deceptikon
0
204
Member Avatar for nitin1

An algorithm runs a given input size n.If n is 4096,the run time is 512 ms .If n is 16384 the run time is 2048 ms .what is the complexity of the algorithm in big-o notaion ? a)o(n^1/2) b)o(n) c)o(nlogn) d)o(n^2) o() is big-oh! is it logical ? I have …

Member Avatar for Gonbe
0
196
Member Avatar for nitin1

can you please tell me how rand () is implemented ? i know it is library implementaion dependent. but still can you tell me the way in which it is mostly implemented ? i have searched on google, but didn't get anything which make me clear about my question. i …

Member Avatar for deceptikon
0
134
Member Avatar for nitin1

code 1: void fun(const int **); int main() { int **p; fun(p); } code 2: void fun(const int **); int main() { const int **p; fun(p); } code 1 is compile error and 2 is not. can you explain why ? as per my knowledge, we can convert a non-const …

Member Avatar for nitin1
0
158
Member Avatar for nitin1

va_arg (ap,int(*)()) here, ap is the va_list type variable and it is started with va_start() already. the place where i have read this said that this is wrong and you have to typedef it first , then you can extract the pointer to a function from the va_arg(). why is …

Member Avatar for nitin1
0
191
Member Avatar for nitin1

#include<stdio.h> main() { int a=258; int *num=&a; printf("%d %d",*((char *)num),*((char *)num+1)); } does the output depends on little endian or big endian structure of machine on which i am running this ? thanks.

Member Avatar for nitin1
0
148
Member Avatar for nitin1

code 1: #include<stdio.h> int main(void) { int a; a= 1,2,3; int b = a++; printf("%d",b); return 0; } code 2 : #include<stdio.h> int main(void) { int a; a= (1,2,3); int b = a++; printf("%d",b); return 0; } Can you please explain why that bracket is making ouput changed ? i …

Member Avatar for pooh1234qwerty
0
138
Member Avatar for nitin1

i know how numerical values are represented in memory. like +3, -3, 0, 1 , 3321 and like this. can you tell me how float, double are represented in memory ? like 3.220, -9876.87 ? i mean how bits are presented in memory ? like for singed number 32th bit …

Member Avatar for rubberman
0
205
Member Avatar for nitin1

int m= i++ || ++j && k--; where i=2, j=3, amd k=5; acooridng to me, it will be executed left to right and then values of m=1, i=3, j=3 and k=5. but i have seen that precednace of && is more than || , than so how this expression is …

Member Avatar for Banfa
0
311
Member Avatar for nitin1

#include<stdio.h> void f(int n) { char pp[n]; printf("%d\n",sizeof(pp)); } int main() { int n; scanf("%d",&n); f(n); } In this program the size of array is defined at runtime,and sizeof operator is printing correct size after runtime initialisation in gcc 4.4. Can anybody explain? we say that sizeof is compile time …

Member Avatar for sepp2k
0
189
Member Avatar for nitin1

i have thought a lot on this. but not getting O(n) solution. given n URL's and you have to find the unique URL in that (if there is any). you have to print that URL. thanks. O(n2) solution is a stupid solution, some O(n) is acheivable, but not getting how …

Member Avatar for deceptikon
0
128
Member Avatar for nitin1

although, i have read C++ books in my past, but as my placement session is there, i just want to have some books from where i can see everything in shortest and concise possible. classes, polymorphism, inheritnce concepts etc like this . any book which u can tell me ? …

Member Avatar for dexblack_1
0
186
Member Avatar for nitin1

int a[]={1,3,4,5,7}; int b[]={2,3,5,6}; int m=sizeof(a)/sizeof(int); int n=sizeof(b)/sizeof(int); cout<<m<<" "<<n<<endl; this code prints 5,4. but when i pass the arrays to some function and then i print the m,n values then it is printing 1,1. i know that they are acting as pointer when i pass then in function and …

Member Avatar for Banfa
0
120
Member Avatar for nitin1

can anyone explain me the all precison and exponent, significant bits which double can handle ? i am not getting it. wiki says it has 53 bits significant bits and 11 exponent. am a little bit confused. can anyone explain me ? (in their own way) thanks alot. although i …

Member Avatar for jephthah
0
165
Member Avatar for nitin1

can you tell me the approach that i have k*n nodes where k,n are integers and no two adjacent nodes can have same colours and i want to colour the trees with n colours. (i am making trees not graphs.) thanks. any help will be appreciated.

Member Avatar for nitin1
0
71
Member Avatar for nitin1

actually, I am trying to do digital watermarking. can you please giv me some hints of algos which i can use to do watermaking on numbers ? like i have array of numbers, then i want to water mark them with some kind of algo and also want to save …

Member Avatar for gusano79
0
109
Member Avatar for nitin1

i want to do topo sort but i want to output the lexographically smallest topo sort vesion of that. http://www.spoj.com/problems/TOPOSORT/ here goes the link of problem. actually, i have done this using DFS , but i am able to do the question "print any possible topo sort" of the graph. …

Member Avatar for cproger
0
261
Member Avatar for nitin1

#include<iostream> #include<string> #include<vector> #include<algorithm> #include <cstdlib> using namespace std; int main() { char s[5]; string g; int p=345; sprintf(s,"%d",345); g=s; g+=".mp3"; cout<<g<<endl; getchar(); return 0; } I have a very small doubt about strings. this is code snippet i have shown. when i have called sprintf(), then it has changed …

Member Avatar for Moschops
0
163
Member Avatar for nitin1

#include<iostream> #include <cstdio> #include<string> using namespace std; typedef struct node node; struct node { int value; node * child[26]; }*root; node * newnode() { node * nn; nn=(node*)malloc(sizeof(node)); nn->value=0; for(int i=0;i<26;i++) { nn->child[i]=NULL; } return nn; } bool insert(string s) { node * temp=root; bool xx=false; for(int level=0;level<s.length();level++) { int …

Member Avatar for deceptikon
0
129
Member Avatar for nitin1

can anyone please explain me in brief that how exactly this container work ? or can u giveme some link of this. i have tried to look on some links by google, but i am not much clear about my doubt. please help me if u can. thanks.

Member Avatar for mike_2000_17
0
423
Member Avatar for nitin1

i am learning C++ from a good time now.. but I am still very confused sometimes in the use of array(char) and string.. can anyone please tell me that what exactly all differences between string and char array ? what can i do with array which i can't do with …

Member Avatar for Lucaci Andrew
0
211
Member Avatar for nitin1

i have a undirected graph and i want to print a cycle with length >=k (given) , can you suggest me a algo ? i dont want any code, snippet. i am hoping for hint and algo for this. thanks. it is guaratned that cycle of length >=k exists.. thanks.

Member Avatar for Taywin
0
142
Member Avatar for nitin1

actually, I am new to C++ , although not new to programming. i have a vector of pairs , vector<pair<double, pair<int,int> >> and i want to sort it in incresing order. for simplicity, i am using sort() inbulit function. does pair has ibuilt '<' operator ? or we have to …

Member Avatar for vijayan121
0
125
Member Avatar for nitin1

can anyone please help me in the sort function ? i have read that there are 3 way to use sort(). 1. use sort(v.begin(),v.end()) and second is sort(v.begin(),v.begin()+n, cmp) then in cmp i can have 2 varaitions, 2.a : cmp as the function (it is okay with me) 2.b. here …

Member Avatar for NathanOliver
0
226
Member Avatar for nitin1

i have an array of strings (2D array). i am taking input of strings and that strings can be same with strings which i have inputted before that string. so i want that i don't enter that string which is already being taken into array. so how can i do …

Member Avatar for deceptikon
0
131
Member Avatar for nitin1

#include<iostream> #include<algorithm> using namespace std; #define MAX 10000000 #include<stdlib.h> #include<string.h> char s[MAX]; int p[MAX]; int bucket[MAX],nbucket[MAX]; struct suffix { int idx; }pos[MAX]; int H=0; bool cmp(struct suffix i,struct suffix j) { if(H==0) { return s[i.idx]<s[j.idx]; } else { if(bucket[i.idx]==bucket[j.idx]) { return bucket[i.idx+H]<bucket[j.idx+H]; } else { return bucket[i.idx]<bucket[j.idx]; } } } …

Member Avatar for deceptikon
0
618
Member Avatar for nitin1

yesterday, my RAM crashed. that was of 1 GB and now i wana purchase new one. I am thinking to buy 2 GB RAM. specifications for PC : model- HP pavellion model age: 4+ years RAM: 1 GB(initially) Processor: intel core 2DUO Hard disk: around 600 GB operating systems: Window …

Member Avatar for webjack
0
198

The End.