429 Posted Topics
Re: Dear All, Kindly help me regarding this questoin of C++(OOP). Write a template function that returns the average of all the elements of an array. The arguments to the function should be the array name and the size of the array (type int). In main(), exercise the function with arrays … | |
Re: You could do something like [code] system("cc -c test.cpp | tee out.log") [/code] or [code] system("cc -c test.cpp >> out.log") [/code] | |
Re: i dont think you should assign a char inside double quotes. Try play[2] = '*' if (play[2] == '*') | |
Re: From the package Manager you can install 'DrPython' . It's a neat IDE for writing/debuggin/executing python scripts. | |
Re: Use the 'sleep' function available in 'time' module. | |
Re: One more way is to use a single dimension array. You can as easily take all the inputs from the users and then declare a single dimension array dynamically, size would the product of the the dimensions. and then while accessing the elements you can use pointer arithmetic. something like: … | |
Re: hex2bin[h] will give the value for the key 'h'. i executed each statement separately, without declaring the dictionary and the output will make things very clear to you [code] >>number=1000 >>for h in '%X'%number: print h 3 E 8 [/code] now you can see that 'h' gets values 3,E,8. All … | |
![]() | Re: The size of the array has to be known at compile time. If it has to be decided at run-time please use dynamic arrays. When you used #Define the size was known at compile time hence it worked. |
Re: Can you post the code if possible. also a sample file or a snip of the data in file. | |
Re: Algo will be: 1>divide the number by 10. 2>print the remainder or store it in an array. 3>assign the quotient as the original number and loop steps 1-2-3 till quotient it less than 10 4>print the last digit or store it. Now you should have each digit. | |
Re: There's a thread in this forum, 'c/c++ faqs and practice problems', right on top, you can try to solve the problems mentioned in that. | |
Re: Where is 'Status' defined?? .. Basically 'Status' is not a native Datatype of c++ and so it doesnt have a predefined '==' operator for it. So you need to overload the particular operator before you do something like Status == xxx. Read more about the topic "Operator Overloading" and you … | |
Re: 2 1/2 years for me .... and i realise that it'll take me time to be a pro in c++ . In contrast i see people who use Java become proficient much quickly. There was a time i was thinking of shifting to Java(around a year back) but then stuck … | |
Hi, I have 2 modules, grepforapp.py and myApp.py. Basically i'm trying to make a 'search' utility. myApp makes the UI with one textbox for taking input, start button and a list box which displays the file names where the pattern was found. grepforApp walks through the dir tree and searches … | |
Re: This code is not even compiling. If you can post the correct-compiling code i can try to find the problem. | |
Re: if you want to pass a 'Paths' type to 'distance' you simply have to call like this [code]distance(trajectories)[/code] since trajectories is of type 'Paths', in the definition you will say [code]double distance(Paths trajectory){}[/code] ![]() | |
Re: malloc allocates memory and returns a pointer to the beginning of that block of memory. You need to assign it to some pointer not an object as you are doing here. Change that to pointer and it should work. i couldnt really understand your 2nd qs, would be helpful if … | |
Re: you can put the sumAll function in baseClass. The printAll can be made virtual and also moved to base class. This way you can sum up the values in base(since both are int's) and then print the correct message out. i'm not sure why you're using so many static's and … ![]() | |
Hi Guys.. Can someone explain to me what's the difference between sending any data over a socket vs sending an http request? i mean sending an http request would also be happening over a TCP socket, am i right? so basically it's as simple as sending data from client socket … | |
Hi, When i search for a pattern in a file how do i get the line and line#? basically i want to replicate the 'grep' command functionality. Now i can easily say whether the pattern exists or not using re.search funtion but i'm not able to print that particular line … | |
Re: You need to include the file which declares cout,cin i.e. #include <iostream> and namespace 'std'. i dont think you need the stdafx.h at all. and please read the welcome guide to understand the posting rules and regulations. | |
Re: Even then output might not be what you desire, getc returns the character currently pointed and also advances the position indicator by 1. so it'll always stub the first char from the output. since you're already checking for the 'eof' you dont need this extra check using getc. You can … | |
Re: > 2) tell the function the number of each dimension's element. > > `void function(int& aaa[][], int 1d, int 2d)` > you dont need to say `int& aaa` just `int aaa` will be enough, also i think that you will have to give the 2nd subscript of the array `int … | |
Re: It could just hang waiting for some input which it's not getting, in that case we need to check the time elapsed and restart the program. Frankly speaking i cant think of a way to do it rt away, and i'm in a little hurry, but this was just to … | |
Hi, We're using curses library functions to draw windows in our project. For showing an error the error message is enclosed within '-'s , it seems to be working fine till we ported to a new linux machine where its displaying some garbage instead of the '-' . To be … | |
Re: well you cant really name the elements of an array, they need to be accessed using the subscript.However to identify each object you can add a unique field in the class and set it for each object. Then when you fetch the object just check for that value to identify … | |
Re: :) ... dude.... what do you mean by 'link classes' ? | |
Re: I feel that for talking between different processes you will need to use CORBA(Common Object Request Broker Architecture). Atleast that's how we do it here, there might be other methods though. So basically what happens is, your servers register with the broker. Client request for the server object from broker. … | |
Re: >>I.e. if we open a text editor will we find threads inside? Text editor will definitely be multithreaded. Imagine a scenario where you send one document for printing and are writing into another document. Almost every application we use in our day to day lives will be multithreaded. The fast … | |
Re: 1-> What is the expected output? 2-> What's the output you're getting right now? 3-> Post the complete code 4-> Please use code tags to make you're code readable | |
Re: i'm trying to execute this program and everytime it tells me the same thing.. [quote] Welcome to the imaginary drink machine! Please choose your icey cool beverage!! --------------------------------------- 1. Cola $0.75 2. Root Beer $0.75 3. Lemon-Lime $0.75 4. Grape Soda $0.80 5. Cream Soda $0.80 6. Nothing thank you … | |
Re: hi..can you please post the 'correct' version of code using code tags and also the errors in one single post. That ways it'll be easier for people who want to help. | |
Re: The definition can be in any file, since its not a class member. your code seems fine to me. inside the defintion, you can decide what all you need to output when you do cout << book. [code] ostream& operator <<(ostream& outs, const Book& b) { outs << b.publisher << … | |
Re: mostly this type of error comes when you are trying to access an index which doesnt exist in the vector. suppose you have only 5 elements in the vector and you try to fetch [5] or [6] element. in your sellstock method you are looping from 0-6, can you check … | |
Hi Guys... i'm not so good at oracle, sql and related stuff.. but i do need to write some simple query's from time to time and i do need to understand that which all tables get updated by a particular transaction. I can do that by going through the code, … | |
Hi.. i have installed Ubuntu 7.10 on my laptop. it also has windowXP installed. i'm able to access wireless network on windows but on ubuntu its not detecting it. when i connect it through a wire i'm able to access. i read on the net, seems my WAN card which … | |
Re: is the stack.cpp also having a main? | |
Re: i guess your first file should have these 2 lines "3 3 1 2 3 4 5 6 7 8 9" for a 3*3 matrix 1st line of the file gives you the number of rows(3) and number of cols(3) and the second line is givng row*col numbers. hence a[0][0] … | |
Re: doesnt seem good to me ... why is the base class named 'life'? and why does 'life' have a member function called 'eats' ? and then you have 'producers' and 'animals' deriving from life.. you might have some explanation for all the names and member functions. but you should always … | |
Hi.. whats the best way to initialize a char* ? i tried using char* p = ""; and it gives segmentation fault at times. not sure how to initialize it. this is the function where i'm using it. screenReturnValue variable is not getting initialised properly everytime, when i call this … | |
Hi Guys.. is there someway i can change my screen name from 'chandra.rajat' to something else ??... -chandra | |
Re: you can use system ("sh scriptname"); | |
Re: [QUOTE=Rajith Cherian;587065]The code could look like [CODE] if ( ( i%2 ) == 0 ) { nEvenSum += i; //Sum of even Numbers } else { vOddNumber.push_back(i);//Storing all Odd Numbers nSumOddSquare += ( i*i ); // Sum of square of odd numbers } [/CODE] Hope this is your requirement[/QUOTE] incase … | |
Re: just print out the array using 2 for loops. something like [code] int a[m][n]; cout << "Name" << " " << "Total" << endl; for(int i=0;i<m;i++) { for(int j=0;j<n;j++) { cout << a[i][j] << " " ; } cout << endl; }[/code] do some formatting. | |
Re: loads of examples available on this forum.. please use the search option. | |
Re: but why are you taking the numbers into char arrays? | |
Re: 'Vector' - 'vector' |
The End.