- Strength to Increase Rep
- +10
- Strength to Decrease Rep
- -2
- Upvotes Received
- 253
- Posts with Upvotes
- 194
- Upvoting Members
- 128
- Downvotes Received
- 12
- Posts with Downvotes
- 12
- Downvoting Members
- 5
Design a function named max that accepts two integer values as arguments and returns the value that is greater? For example: if 7 and 12 are passed as arguments to the function, the function should return 12. Use the function in a program that prompts the user to enter two … |
|
Hi, I am facing an issue in string to const char pointer conversion. I am doing stuff in the fun() but here i am just giving my example. Here it the code: // Helper function string fun() { string abc = "Daniweb"; // print here #1 return abc; } // … |
|
hopefully soone can help me with this lol , this grammar im looking at is kinda tricy and i feel like theres something im missing. im trying to find the first and follow of the below grammar S -> [] | [S] | SS For the first I got: First(S) … |
|
Alright. I'm teaching myself python from 'Learn Python the Hard Way: 3rd Edition' by Zed Shaw.. it's been informative so far. Definitely learning. After his lessons, he gives study drills, extra project to put your learning to use. He challenged us to: "Find out what Zork and Adventure were. Try … |
|
I am designing a software and want to save data in a txt file. but dont want the user to open them as txt file, only the app should do it. Is this possible? if yes, how? I've searched in google, but not any good reason to help me out. |
|
I know I should have try it first but I dont understand what is this asking about. My english is my very bad. Can you please telling in easy english. PLus this is very confusing. Please help me out Write a BNF grammar for the for statement of C. Assume … |
|
Hello, I have a question about ascending order sorting using the Comparabe interface: When I add the keys of my Hash Map to a TreeSet object and implement the compareTo as below, I get descending order of sorting of names: public int compareTo (Accounts a) { return a.name.compareTo(this.name); } // … |
|
public class adding public class adding { public static void main(string[] args){ { int a=1; int b=2; sum c=a+b; system.out.println c;(sum c)-> } } help illegal start of expressions |
|
I am writing a program for extra practice from my book on finding the max element in array using Java Generics. My Code so far is: public class GenericMax { public static void main(String[] args) { Integer[] numbers = {1, 2, 3}; //Creates array of integers System.out.println(max(numbers)); String[] words = … |
|
I have created an app with simple login authentication, it is actually a twitter clone. The user logs in and access the pages, etc. But when the user posts something from there profile. It gives an error NoMethodError in RibbitsController#create undefined method `userid=' The error is around line 5: class … |
|
I have a question about programming/scripting in general, which I'm still driving over rocky terrian trying to learn. The compiler, regardless what it is; reads though code from top to bottom, does it read though all the lines of code first, or does it stop at functions etc and continue … |
|
I have a little confusion in my mind. I know very well the difference between preincrement and postincrement, postdecrement and predecrement. But i wonder how do these operators work during loop. I ,myself, use postincrement or decrement in loop as follows: for(int i=0;i<5;i++) { //code } But in my book … |
|
Hello guys! I'm working a project and it seems that there's something wrong with my switch-case. For example, in the user menu, the user can input the number 2 then it would allow them to deposit, but somehow, it keeps displaying the first switch-case. switch(resp){ case 1: users.get(0).displayProfile(); users.get(0).editProfile(); break; … |
|
assume latgeInt=2147483647 Debug.Log(largeInt); //2147483647 float largeFloat = largeInt; Debug.Log(largeFloat); ///2.147484E+09 int backAgain = (int)largeFloat; Debug.Log(backAgain); //-2147483648 *This part i did not get. I assume there was some data loss when float was explicitly casted into int . But the loss should be in right most digits. How come sign got … |
|
int main() { int a=10; printf("%d",a); return 0; or return a; } # 1ts question:In the program Why you used 0 in return 0 ; and 2nd question : if you use a in return a; then it also print the correct output but why ? # |
|
public static boolean isEmpty(int grid[][]) { for (int r = 0; r < grid.length; r++) for (int c = 0; c < grid.length; c++) if (grid[r][c]==0) { return true; } return false; } the question is : after returning true it back to (for loop) or not ???? |
|
Hi everyone, My program is crashing on taking input of alpha-numeric and store it in char[]. I don't know why, please anyone help ! sample input : C9H8O4MgOH #include <iostream> #include <string.h> using namespace std; bool hydroxide(char[]); int main() { char formula[] = ""; cout<<"Enter chemical formula : "; cin … |
|
#include <iostream> using namespace std; main() { int matrix[2][2]; for (int i = 0; i<=2; i++) { for (int j = 0; j<=2; j++) { cout <<"Please Enter matrix "<<i<<"th row and "<<j<<"th Column "; cin >>matrix[i][j]; } } //Display the Matrix for (int i = 0; i <= 2; … |
|
Hey guys, I've started building a program for college, everything was running really smooth and I've started to pick things up in the past couple days, but for the life of me I cannot find where I have a syntax error, neither can my friends :/ I've tried looking up … |
|
I read many articles on Web regarding this. I am able to understand what static_cast does. I am not to properly understand why, and when we have to dynamic cast. There is something "we can downcast the pointer when it is polymorphic". I am not able to understand what they … |
|
Hi, I am learning Git system these days. I have made a new folder in ubuntu and in terminal did this: 1. git init 2. then made a file testfile1.txt 3. then made a branch using "git branch newbranch" 4. then checkout to this branch. 5. then, made a new … |
|
What are the differences between NP vs NP-Complete vs NP-Hard ? I am aware of many resources all over the web. I'd like to read your explanations to undrestand better |
|
I tried to build really basic associative array but it turned out I don't have enough knowledge, so I tried something less, and less, and less, because I kept failing at it. Finally I just tried to set variables and print them in the command-line. But I can't even do … |
|
Hello, how does an Interpreter work ? I read up on it and it seems you just parse each line and then (somehow) execute the lines. I suppose the code needs instructions on how to execute each line ? |
|
Hi It's been a while i'm learing C++ but still i have some issue with `Move semantics` and some other stuff. I wrote this class but i don't know why the `Copy constructor` is getting called and the output is a little strange to me, shouldn't the `Move Constructor` gets … |
|
I have this code which if i press msgbox yes it opens another frame but if i do same thing from another function (counter) i get an error. Can someone help me and tell what is wrong? import tkMessageBox import Tkinter as tk from Tkinter import * from functools import … |
|
# Is {(1,1), (2,2), (3,3)} symmetric? transitive? Yes! Yes! ## Why is R = {(1,2), (2,3), (1,3), (2,1)} not transitive? Because (1,1) and (2,2) are missing. ## # |
|
I've just started learning C++ on Linux. I have written a very small program which compiles but I get run time errors everytime I run it. The code is shown below: #include<iostream> int DoubleOf(int n); int main() { std::cout << "Double of 5 is " << DoubleOf(5); return 0; } … |
|
Hi, I have this doubt i have read that "We must declare c to be a type big enough to hold any value that getchar returns We can't use char since c must be big enough to hold EOF in addition to any possible char. Therefore we use int." it … |
|
Hi everyone and good morning :) . i want to simply read from the linux file "urandom" a random number and print it out on screen.just simple as that. this function should be in a file called myrandom.c ( myrandom.h must be made also, which has my function dekleration ) … |