- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 8
- Posts with Upvotes
- 8
- Upvoting Members
- 8
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
97 Posted Topics
Re: You coded something? Try it yourself first, if you have any problem then we'll help. | |
Re: [*]Write a program that accepts XHTML, parses and removes the tags. Then it prints out the remaining text. (Intermediate) We have to just remove the tags and display the rest? | |
Re: Its working at my end .. Can you specify the error? And please use CODE tags. | |
I am implementing RSA in C++ and here's my design(code structure). *keygen.h* namespace rsa{ class keygen{ public: //Constructor keygen(size); //Generate keys void generate(); //Getters string gete(){ return xyz; } .. .. .. private: //initializes bignums void initall(); keygen(){} //Private Member variables goes here } } *prime.h* namespace rsa{ //First 100 … | |
Re: What do you mean by removing the necessary elements from an array? Do you want to output increasing elements in an array and remove the smaller ones that comes after them? | |
Re: [QUOTE=coolbeanbob;1691247] I have another question. When I initialize x to 0123, x prints to the console as 83. Why is this?[/QUOTE] When you prefix a number with 0, its treated as octal. I think now you can figure out why 83 is getting printed :) | |
Re: [QUOTE=jpd5066;1687014][CODE]#include <iostream> #include <cmath> using namespace std; int main() { double posNum = 0, posPow = 0, sum = 0, newVal; int counter = 0; while ((posNum != (-1)) && (posNum >= 0)) { counter++; cout << "Enter a positive number (-1 to exit): "; cin >> posNum; if (posNum … | |
Re: Can you please provide some testcases for testing? | |
![]() | Re: What error did you get when you try to compile? ![]() |
Re: Binary Search continuously divides the array and keep on searching for the target value whereas in your code the function doesn't do that. It just checks whether the target value is at mid and then changes first and last and then terminates. You would like it to continue searching rather … | |
Re: On the right track!! The program is reading the file and displaying all the names with index correctly but you need to include string header file. Now for your question, ask the user to enter a string and then start comparing it from the start of vector. Something like.. [CODE=C++] … | |
Re: First, you are calling the factorial function before taking the input from user i.e. num is not initialized. Secondly, the loop inside factorial function is infinite. It is supposed to run from 1 to num, but watch carefully you are multiplying num inside it so it'll keep on increasing and … | |
Re: Yes, cout is a variable but of type ostream. To be more precise its an object of class ostream which has << as overloaded operators. So whenever you use that operator on cout, it performs output to the screen. | |
Re: You can use this instead..[CODE]cin.getline(charArray, 80);[/CODE] | |
Re: Your code compiles fine? Because length is a function and you are trying to use it as an array [CODE]user.length[i][/CODE] | |
Re: Any code would be greatly appreciated. | |
Re: Problem is not in your code but your logic. The expected output seems to be using compound interest but you implemented simple interest. Try.. [CODE] float raisep = (raise/100); for(int i = 0 ; i < (years) ; i++) { cout << (i+1) << " $" << wage << "\n"; … | |
Re: If you want to display a char[] or pass it to a function just use the identifier, not the index. And word[50] is a character which doesn't exists. When you declare an array A[50], the index ranges from 0 to 49. | |
Re: You are changing the value of variables(a, b and c) while computing the sum of their digits. [code=C++] a=a/10; [/code] Then you compare them with the sum. | |
Re: You are passing the wrong second parameter to getline(), it expects a string. You are passing it a char.. [CODE=C++]getline(file,inf[rows][cols]);[/CODE] | |
Re: You are allocating new memory every time you call *pVketor() and I think that's the problem. | |
Re: Flush the input stream after input... [code=C++]while (cin.get (temp) && temp != '\n');[/code] | |
Re: Instead of [CODE=C++]cin>>str[/CODE]Use [CODE=C++]getline(cin,str);[/CODE] | |
Re: When you print low to high using loop, you incremented num1 and therefore the second loop never runs. | |
Re: The function main() expects a return value. Other than that your code works fine.... [CODE]return 0;[/CODE] | |
| |
Re: Read words from a paragraph, compare them with some equation(what type of equation?) and then add it to a string if it matches? Did I get you right? | |
Re: You want to find the totalcost for each group? | |
Re: You need to understand the basics of pointers, before dealing with linked lists. [CODE=C++]test->Next=Head; Head=test;[/CODE] It adds the newly created test node as the first node in the list. Before adding the list is [QUOTE]Head -> First -> Second -> Third...[/QUOTE] After adding, it will be [QUOTE]Head -> Test -> … | |
Re: haha.. Thanks for sharing :) I surely can use it somewhere. | |
Re: Compiler translates your code to native machine code. You cannot have a compiled binary which runs on all the platforms. True for C and C++. Experts please correct me if I'm wrong. | |
Re: Is that what you asking? [CODE=C++]char alpha='A'; int x=alpha; [/CODE] | |
Re: Same question as gerard4143, Which compiler are you using? | |
I need to write a program, which prints out all the prime numbers between two numbers. The first input specifies the number of test cases, followed by the limits. Here is an example.. [QUOTE] Input: 2 1 10 3 5 Output: 2 3 5 7 3 5 [/QUOTE] I wrote … | |
| |
Re: It will quit when you'll enter q, since the condition will be false and the loop won't execute. [CODE=C++]while(choice == 'c' || choice == 'f')[/CODE] And please use code tags when you post code. | |
Re: Have you defined the function square(int,int,int) somewhere in your code? | |
Re: Sometimes those Intellisense errors\warnings take a little time to disappear. | |
Re: Use cin.get() twice.. [CODE=C++] primenum(x); cin.get(); cin.get(); return 0; [/CODE] There are other ways, but this one's the easiest. | |
Re: Its working fine at my end. After entering the first sentence, it asks me whether I want to continue or not. Can you give a little more detail about your problem? | |
| |
Re: I think its because you have ORed "R", which is a non-zero value and thus the statement always evaluates to true. The same problem with your second if statement. And why you using string when you need to store just a character? | |
Re: As @Taywin suggested, the error is in your sorting... Seems like you have mixed Bubble Sort and Selection sort algorithms. | |
Re: Use the return value, initialize avgScore with average score... [CODE] avgScore = calAvgScore(...) [/CODE] | |
Re: You using string without string header... [CODE] #include<string>[/CODE] | |
I wrote a program which finds the next palindrome. First, it takes an input specifying the number of test cases. The code runs fine in Visual C++, but am not able to run it in GCC. I have never used GCC before so unaware with its functioning. But am expecting … | |
Re: [QUOTE=;][/QUOTE] After generating a random number inside the second for loop, you are comparing it with the current index only. Instead you should check whether the number is in that row or column, if its not, accept it else generate a new one and repeat the above. | |
I'm a lot confused with multi-dimensional arrays and pointers. I tried searching, found and read some articles. But there are still some doubts. We can not use a double pointer(int **) for a two dimensional array, right? Instead we need to have an array of pointers with the length equal … | |
The End.