nitin1 15 Master Poster

what will happen if i download conio.h and explicitly add that file in the section where all other files are there ?

nitin1 15 Master Poster

Start learning C first, You can start by reading yashwant or Let US C for learning it. Then you can try Dennis Ricthie for intensive learning. Then write some short codes and then learn what is Arithmetic progression and then try to write this code. You will learn a lot.

nitin1 15 Master Poster

can i ask one question ? that which thing does not support header files ? Like when u say "conio.h is not supported", so compiler doesn't support ? How can it be ? We insturct compiler to inlclude these-these header files while converting code into machine language. Can you elaborate ? @A.D sir OR James sir. thanks.

nitin1 15 Master Poster

@james sir , Can you elaborate more ? I am just a beginner in JAVA. am not much expert to understand that things easily. thanks.

nitin1 15 Master Poster

actually, instructions which course instructor has provided on website are :

*You can invoke the program using your IDE, or by running the script produced by mvn package. In most shells, you can redirect the output of the program into a text file:

/bin/sh target/bin/run-cbf U1 U2 U3 >unweighted.txt
This works on Windows as well; just run target\bin\run-cbf.bat. Redirecting your output in this fashion will just capture the program output; the logging output should still be displayed in your terminal.*

so, can you please tell what is he trying to say ? and how ? I am stucked on this from last 3 days. thanks if you can help me sir.

nitin1 15 Master Poster

@stuluske yeah. that is good thing which you do. i will remeber this for next time. :D

nitin1 15 Master Poster

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 want my output in the text file. I don't know how to run that project from cmd of windows. I have asked in the chat also and searched google a lot. but me not getting answers. I have my project in C drive then i have folder "project1" then i have folders .idea, target, src and a xml file named as pom.xml. and also cbf-filter.iml file.

So, can you help me now that how can run my project from cmd so that i can get my output in a text file ? thanks in advance.

nitin1 15 Master Poster

When you wake up early in the morning and rushed for college or office and after reaching over there , you came to know that it is off due to some reasons. did it happen with you at any time ? If yes, then what had you done after that ? Gone for movie? or just gone back home ? or just opened the DW and started a thread like this (this is what i am doing :p ) ? :-D

nitin1 15 Master Poster

what is the error ? Can you explaim more about the problem ? thanks.

nitin1 15 Master Poster

freopen() OR fopen(). try to read about them, you will find them useful. thanks.

nitin1 15 Master Poster

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 things. They have their own functions, own packages, our classes. They have given me stub in which i need to write few functions own my own , but how ? They haven't told all functions, all classes which they have ? Can you help me in this ? Thanks in advance.

nitin1 15 Master Poster

@rubberman Can you elaborate it more ? I have explained more about my problem. Please explain little bit more. Am using DEV CPP and writin code in C. now can you help me more ? thanks in advance sir.

nitin1 15 Master Poster

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 dev cpp and codeblocks as my IDEs. thanks in advance.

nitin1 15 Master Poster

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 window disappears. but why it opens each time when i run any MS office product ?

here is the screen-shot which appears :

Click Here

hpw can i remove this ? it takes 2-3 minutes to go away when i close the window. help me if you can. thanks in advance.

nitin1 15 Master Poster

yes, here is the screen shot when i opened my file with notepad++. Click Here

4a85d4564766ef475dca28731ae19ec8

nitin1 15 Master Poster

hmm... and what about my last post in which i posted one code ? Can you see that post also ? thanks in advance to you.

nitin1 15 Master Poster

@James sir,
Can you please throw light on this statement ?

"the increased object code size results in excessive cache misses or thrashing.". Thanks. This was the point which i want to know about.

nitin1 15 Master Poster

"So if you want a function to be inlined across compilation units, you should put the function definition in the header as either static or extern inline."

Please explain this line little bit more. thanks

Secondly, can we relate the disadvantage of long program size with number of page faults ? how can we do that ? thanks if you can help me.

nitin1 15 Master Poster
#include<iostream>
#include<stdio.h>
#include <fstream>
#include <string>
using namespace std;

int main()
{
            ifstream myfile;
            myfile.open("hello.csv");
            string line="";
            char c= ',';

            if(myfile.is_open())
            {
                                while ( getline (myfile,line,c) )
                                {
                                         cout<<"userid: "<<atoi(line.c_str())<<endl;
                                         getline (myfile,line,c);
                                          cout<<"movieid: "<<atoi(line.c_str())<<endl;
                                         getline (myfile,line,c);
                                         cout<<"Rating: "<<atoi(line.c_str())<<endl;
                                         system("pause");
                                }

                                myfile.close();
            }
            system("pause");
           return 0;
}

but it is user-id . it read user id only first time. but then it is skipping the user-d and only giving movie-id and rating correctly. why is it so ? my triplet is like this :

(user-id, movie-id,rating)

but it is skipping user-id.what can be the possible reason ? thanks.

nitin1 15 Master Poster

@ancient dragon, yes my file is :

  • .csv file
  • contains all numeric data
  • that numeric data is seprated with commas

Can you explain getline function way a little bit more ?

@james sir, what are those "quoting" rules ?

thanks in advance to both of you.

nitin1 15 Master Poster

so, inline functions are always good to use in our code ? and why should i prefer macro over the inline and why should i prefer inline over macro ? Can you make it clear little bit ? but, if program length increases, then why it should increase the execution time ? I mean why file size matters as code which is executed is same in both the cases. (when macro is used and second when macro is not used).thanks.

nitin1 15 Master Poster

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 may increase time at compilation time, but shouldn't it help at execution time as we are saving our overheads in the funtionc calling. I know i am wrong some-where, so can you please correct me ? thanks.

nitin1 15 Master Poster

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 to iterate on all the values of a particular user-id. as a user-id has some movie-d associated with it in its row (if i consider it as 2-D matrix, although it is not one). Thanks in advance if you can help me. Actually, I wana see that to which movies , a particular user-id has give rating. like a person with user-id 346 has given rating to say movie-id 98, 76, 89, 90. so i wana calculate my answer as 4 as it has rated 4 movies. thanks.

nitin1 15 Master Poster

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 google, i found that .csv is a normal plain text file that has data seprated by columns. Thanks in advance. :)
P.S help in C or either C++ will be helful. no problem with C++ as i have a good hand in C++ also. thanks.

nitin1 15 Master Poster

that mean out of the 3 codes, all are dependent ones.Right ? All need to be tested on the target machine ? We can never say that code which i wrote is more optimized ? And I can never say that normal star operator will give best results as we don't know in which way compiler will optimize it ? am i right ? correct me if i wrong at any point. thanks.

nitin1 15 Master Poster

still ancient dragin sir , So what is the answer ? Can i say that there is standard way in which "all" compiler optimizes the multplication operator? Discussion is quite well, but answer is not clear yet. I understood one thing that (as you said) it is dependent on compiler, so what about the codes which i posted above. please clear these things. thanks in advance.

nitin1 15 Master Poster

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 one more question :

n = (n<<2 + n<<1 + n);

now, which one is faster ? first one or second ? I was confused in this.

Then , I asked somebody else about this, he said the following code is fastest.

int n=10; // for example

n = n*7;

Then , it confused me badly, Can you help me out ? Which one is faster and why ? I am not able to get this thing that who is right and which code (out of 1 and 2 ) is faster? And is the 3rd code fastest ? Thanks in advance.

nitin1 15 Master Poster

yes, but Not only these 3, i need to keep track of many of them at one place. checking microsoft and 10 companies' official web-pages is not an easy task. I know and I will first get some experience first. Is it a crime to keep track of them or know some sources before-hand for keeping track ? It is not a crime in India atleast. I hope you will understand what i am trying to say. thanks. ;)

iamthwee commented: -1 for living in a fantasy world and attention seeking as an adult +0
nitin1 15 Master Poster

Like in India and many other countries, value of their currency is going down and down. What can be the possible reasons for this ? I am not a economics student, still want to know what exactly is there behind the screen ? thanks. ;)

nitin1 15 Master Poster

yeah bro i know that. I am just asking that. I know that Google is a very very very big target , atleast for me at this stage. Thanks for your response. :)

nitin1 15 Master Poster

please elborate your problem so that I can help you more. thanks.

nitin1 15 Master Poster
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b=2,c,n;

printf("enter n");
scanf("%d",&n);

for(a=2;a<=n;a++)
{ 
    b=2;    
    c=1;         
   while(b<a)
   {
      if(a%b==0)
      {
         c=0;
         break;
      }

       b++;
    }


if(c!=0)
{
     printf("\n%d",a);
}


}
getch();
}

Firstly, start using a better IDE then Turbo because it will help you to have good interface to make codes. Turbo is okay, but if you want to improve I will suggest you to start using DevC++, Codeblocks, Visual-studio etc.

secodnly, your code is correct but has some initialization problems which i have corrected and posted above. I hope this will help you. thanks.

nitin1 15 Master Poster

that means NanthanOliver is wrong ? right ?

nitin1 15 Master Poster

but have you read my questions which i have written ? Please clearfiy them that why is it not undefined ? I mean they are incremented between one sequqnce point. is it okay ? If Yes, then Why ? thanks.

nitin1 15 Master Poster
int a=3;
cout<<a++<<" "<<++a;

what is the expected output of this problem ? It is undefined behaviour as it is updating value of "a" once more than once in a sequence point ? Correct me if i am wrong at any point. thanks if you can help me.

nitin1 15 Master Poster

can anyone tell me the reliable and good source from where I can keep track of all the vacancies in the companies like Amazon, Microsoft, Yahoo etc ? thanks if you can help me. source that is reliable and on which i can be somewhat "dependent". thanks.

nitin1 15 Master Poster

you have to show some effort first. We will help you for sure if you will show us something which you have tried. Do some research and try to explore things and ask any doubt if you face any problem. hope it helps! thanks.

nitin1 15 Master Poster

yeah, true sir. :p but actually, I am too curious to know about companies that which company is good to work and which company has good pay , which company has good and challenging work. It is just my interest to know about these companies from people like on DW. That's it. thanks sir. ;)

nitin1 15 Master Poster

Can we discuss some points on this ? Is it a good job for the freshers ? Some people may have some points in his/her knowledge regarding this. than please share it here. thanks in advance. :)

somjit{} commented: its real easy to make yourself look silly when you ask these questions in this manner. +0
nitin1 15 Master Poster

Welcome to DaniWeb.

nitin1 15 Master Poster

Click Here

this might help u. you can read for learning the basics of loop. thanks.

nitin1 15 Master Poster

no. i hope it is not in C. Actually, this was my interview question which was asked in round 1 which was tagged as "C concepts round". So I thought I should also keep it there only. They just want the solution , no matter if they are asking this in C concepts round. what can be the solution of this ? thanks.

nitin1 15 Master Poster

Click Here

your code matched with the code given here. It seems you are clear with the algo, but some issues are there which are hard to find by just looking at your code. I have given you link which you will find useful as it explains this concept very greatly. hope it helps! thanks.

nitin1 15 Master Poster

Click Here

This is a great link which will give you idea that how exactly templates work. It will be beneficial for you. hope it helps! thanks. :)

nitin1 15 Master Poster

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 count of unique visitors on my site? I am just asking the idea, implementation is not needed by me. thanks in advance if you can help me.

nitin1 15 Master Poster

declare your template outside the main() function and then try to compile it. hope it helps.! thanks.

nitin1 15 Master Poster

here, you are assigning 75 to b. Then, you are adding 9 to 75(b ,actually) and assigning this value to a. So , as the result of it, you have a= 84 and b as 75 which will be printed in the 5th line in the code snippet. hope it helps. thanks.

nitin1 15 Master Poster

As your code is not much readable and also, too complex for this trivial algorithm. I will you suggest you few links and then try to read your code again as what i feel after reading your code is that you haven't understood the algorithm correctly.

  1. Click Here
  2. Click Here
  3. Click Here

After these three links, you will be ready to write code for DFS. hope it helps! thanks. ;)

nitin1 15 Master Poster

try to put "break;" statement after each "case" ends. and then try to run your code again. hope it helps.

for ex:

switch(x)
{
       case 1:
               // your statements
               break;
       case 2:

               // your statements
               break;
}

thanks.

nitin1 15 Master Poster
printf("%c",x);

where x is any character variable which is defined like this :

char x;

hope it helps!! thanks.