Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
41 views

I have to write a program that simulates 2 dice rolls 4 times, if the 2 dice end up as the same number a certain multiplier needs to be increased by 10, so far I've managed to simulate dice rolls by ...
Rudmer Overdijk's user avatar
-4 votes
1 answer
721 views

I have an error saying: (error CS0136: A local or parameter named 'facingRight' cannot be declared in this scope because that name is used in an enclosing local scope to define a local or parameter). ...
Joost Krijn Buursink's user avatar
0 votes
4 answers
11k views

I want to add float average variable inside the cout. What's the perfect way for it? int first , second , third; cout<<"enter the first number: "; cin>>first; cout<<"enter the ...
Ravi Arya's user avatar
1 vote
1 answer
2k views

I am trying to create a program that spell checks what the user has typed in. They have to type the word 'type' in 10 times correctly and it will display a message saying how long it took. My problem ...
John Smith's user avatar
0 votes
4 answers
298 views

averageLength gets all the words the user has entered in the previous case and gets the average amount of words. The switch statement sits under the main method (not shown here) but when I try to ...
John Smith's user avatar
0 votes
2 answers
47 views

I have declared identical const values (sort of). Here's what I have so far... import React from 'react' function Component_a() { const x = 5; const y = 10; const image_a = [...Array(x)]....
DaOneRom's user avatar
  • 294
-1 votes
1 answer
89 views

The problem exists in the first nested loop, where the results doesn't go out as expected, I'm working on CodeBlocks 17.12 What I did to try fix the problem is to change "int s[n]" to "long long s[n]"...
berky ross's user avatar
3 votes
3 answers
93 views

public class Outer{ public class Inner{ } } public class Main { public static void main(String[] args) { Outer objOut = new Outer(); //Outer.Inner object1= objOut.new ...
raz's user avatar
  • 492
2 votes
3 answers
159 views

I am confused about the following Java statements: ArtClass artClass0 = new ArtClass(); int int3 = 73; boolean boolean0 = artClass0.foo(int3); Is the first statement called constructor statement? For ...
Adam Amin's user avatar
  • 1,486
3 votes
3 answers
27k views

"What are explicit declaration & implicit declaration of variables in programming language concepts and their advantages and disadvantages?"
Sakun Chamikara's user avatar
0 votes
1 answer
103 views

In my team we had a small discussion if a field declared 'private static final' in a class has any advantages from just declaring it 'private final'. For example if I have the following line in my ...
peer's user avatar
  • 364
0 votes
2 answers
77 views

Is it common practice (or at least syntactically valid across browsers and implementations of JS) to abuse RTL associativity of assignment operators so that one can define two variables (with the ...
Kithraya's user avatar
  • 406
10 votes
4 answers
3k views

I've been writing C++ code for a while now, but there's something I've been wondering for some time, without being to find a clear answer. My point here is the following: let's say I have a function (...
Thomas Kowalski's user avatar
4 votes
2 answers
3k views

While playing with pointers-to-member I encountered a behaviour that seems slightly inconsistent and somewhat counterintuitive to me. Consider the following dummy structure: struct foo { int x; ...
Fureeish's user avatar
  • 13.5k
0 votes
1 answer
56 views

I'm trying to traverse an object to find all instances of a key, and get any value associated with the key. (The object may have a key multiple times at different depths) I find the value I want just ...
Joshua's user avatar
  • 11
0 votes
1 answer
341 views

I am loading two js files within an HTML page where both files contain the declaration of variables with the same name. I would like to know if there is a way to declare two variables with the same ...
Abdou Bestmood's user avatar
0 votes
2 answers
86 views

Can somebody explain me the difference between the following? Those two float *pointer[10]; float *(pointer[10]); and those two int(*pointer_function)(); int *pointer_function();
coolchock's user avatar
-1 votes
2 answers
93 views

I am creating a feature in my chat bot that changes the bot agent name. I declare the name of the bot at the top. bot = "Bot" Then I create a function that takes input from the user and changes the ...
user avatar
-1 votes
3 answers
2k views

A "foreach" in Java is, for example for (Mouse mouse: mouses) { [...] } We can't do: Mouse mouse; for (mouse: mouses) { [...] } I quote geeksforgeeks: Since the i variable goes out of scope ...
Marco Sulla's user avatar
-1 votes
1 answer
158 views

I have overloaded the assignment operator for a particular class and after that I soon found out a problem. During the declaration of a class object, if I initialize it with another object that ...
Ray Jasson's user avatar
1 vote
1 answer
226 views

i'm trying to declare arrays depending on the user input, consider if user enters 2, then i need to declare 2 arrays. like :int case1[10]={},case2[10]={}, i tried it using macros CONCAT but it didn't ...
krypton's user avatar
  • 387
-2 votes
1 answer
196 views

So, I was trying to code some test cases for a Java project I'm doing, and I decided that I wanted to move them into a function of their own, and choose between them using a parameter of the test ...
nick012000's user avatar
-1 votes
1 answer
41 views

I want to get the intersection of two linked lists but when i declare the iterators outside the for loop it just doesn't work // THIS WORKS FINE for (SList iter1 = list1 ; !slist_empty(iter1); iter1 ...
Matias Meroi's user avatar
1 vote
4 answers
72 views

While I was going through my questions, I found the these questions: 1) int*p; 2) int p(char*a) 3) int(*p(char*a)) 4) int *p(void) 5) int*(*p[10])(char a) (Please correct me if I'm wrong with my ...
Sandesh Ghimire's user avatar
1 vote
1 answer
110 views

I've always declared a worksheet object using the syntax Dim w as Worksheet, but recently I came across some code that used Dim w as Excel.Worksheet. I checked with the Object Browser which stated ...
DaveU's user avatar
  • 1,082
3 votes
2 answers
2k views

This might be a noob question, but I'm trying to make a simple player move in a 2D-grid in SFML. I'm creating a while loop for rendering what is happening, and I can get it to work, but I want to use ...
Rasmus H's user avatar
19 votes
2 answers
58k views

According to this documentation by Microsoft, the following code can be used to make sure; a, b, and c are all Single; x and y are both Double Dim a, b, c As Single, x, y As Double, i As Integer ...
Kouichi C. Nakamura's user avatar
4 votes
3 answers
2k views

I absolutely hate these unnecessary steps in programming where you declare and assign a variable on one line and ask for an input in the next. To keep it short, I want to create a variable and ask ...
user avatar
1 vote
2 answers
135 views

I have this enum : enum WeatherMapDisplayType { case temperature case wind } Can I declare a variable like this ? let markerView: mode == .temperature ? WeatherMapItemTemp : ...
user avatar
5 votes
2 answers
2k views

We're working with a new company and they have a coding standard where they declare all Javascript variables used in a method immediately in the first line of the method. I asked if there was a ...
BVernon's user avatar
  • 3,957
-1 votes
1 answer
307 views

I am trying to declare the List like below code. public List<string> t1,t2,t3 = new List<string>(); When I am trying to add something to List then it gives me error of was null on run ...
Shyam's user avatar
  • 627
-2 votes
2 answers
161 views

I wanted to use a function to search through a list of possible message values. E.g, a message may be '01 02 03' hex, and then I will check against possible messages if it is any of those. What I don'...
Lukali's user avatar
  • 343
0 votes
1 answer
843 views

Can the array variable values persist when macro finishes? I have declared a global variable: Option Explicit Public Arr2D As Variant Public Sub ReadDataToArr() Arr2D = [MyNamedRange].Value End ...
Przemyslaw Remin's user avatar
0 votes
2 answers
447 views

I am trying to build a chess engine as a long time project. Currently I am working on a method to flipp the board (like turning it around but changing colors as well). Uppercase letters represent ...
Maxi Kießler's user avatar
0 votes
1 answer
149 views

This must be simple, but I couldn't figure it out even after reading Microsoft's specification. How do I store DataGridViewColumn type in a declared variable? It has to provide a collection of types, ...
Oak_3260548's user avatar
  • 2,030
0 votes
1 answer
231 views

Studying Swift grammar declaration of closure. I'm having a problem with: let add: (Int, Int) -> Int add = { (a: Int, b: Int) -> Int in return a + b } error: variables currently must ...
jmmm's user avatar
  • 3
1 vote
2 answers
181 views

I have a local variable implicitly defined as var, and is being populated with objects retrieved from a database through Entity Framework. When I hover over the variable I get the details as shown in ...
pnizzle's user avatar
  • 6,479
1 vote
1 answer
288 views

Now, I know that StackOverflow is not a place to ask for help on homework, but this question has me completely stumped. I showed it to my friends and they are just as confused as I am. I had two ...
Aaron Franke's user avatar
  • 4,292
0 votes
1 answer
32 views

Let's say I have a text file and a line like this: This is an example line within a file. What I need to do is to modify this line based on a prefixed column position, and an input expectedString. ...
Quan Huynh's user avatar
1 vote
2 answers
3k views

I saw that this question was asked many times and I've been looking in every single one for a solution but couldn't find one for my specific problem. I'm composing a link using different strings and ...
CuriousPaul's user avatar
4 votes
2 answers
7k views

I need to set i depending on a condition: let i = null nightmode === true ? i = 1 : i = 0 Is it possible to declare i within the ternary expression, or does it have to be in outside of it (to handle ...
WoJ's user avatar
  • 30.6k
1 vote
1 answer
196 views

Having a procedure with alot of blocks of nested for-loops ex. one block could look like this for a := 0 to x do //Do something for b := 0 to x do for c := 0 to a do //Do something Is ...
Hans's user avatar
  • 152
2 votes
1 answer
2k views

I am making a npm library at the moment and was wondering how other people implemented the autocompletion and variable type declarations in VS Code. For example I can type httpconnection.addListener( ...
Sv443's user avatar
  • 749
0 votes
1 answer
352 views

To declare a multiple character variable, I chose to use structure where, there will be a character pointer field and an integer value field. My "testy.l" file has a regular expression for variables ...
surre5l's user avatar
  • 27
2 votes
0 answers
30 views

If I declare three variables in one line as below ClassA a,b,c; What is the order of their creation? Is the order defined by C++ standard or it depends on compiler?
pasha's user avatar
  • 2,115
1 vote
1 answer
1k views

I have a function that gets called in two different scenarios. Scenario 1 gets triggered by a dropbown selection, and I set the variable "sheetName" based on the selected value. Scenario 2 doesn't ...
sonja's user avatar
  • 934
0 votes
3 answers
2k views

Why does the following code produce an error? I don't understand why the curly braces are making a difference. #include<stdio.h> int main(void) { { int a=3; } { ...
Debmalya Panday's user avatar
0 votes
4 answers
104 views

Sql Fiddle example I have this table structure: CREATE TABLE IF NOT EXISTS `client` ( `id` int(6) unsigned NOT NULL, `name` varchar(200), `balance` decimal NOT NULL, PRIMARY KEY (`id`) ) ...
Esraa_92's user avatar
  • 1,568
-5 votes
2 answers
80 views

This code take input from the user (characters C,T,B) and (int 0-24 and 0-60) to calculate the cost of parking based on the type of vehicle the user inputs. the last line of code in the program is ...
RebornxAngel _'s user avatar
2 votes
2 answers
3k views

According to C++ : Creating an array with a size entered by the user creating arrays with runtime bounds is not allowed in c++. But I get below code compiled without errors. #include <cmath> #...
vikum sri wijesinghe's user avatar

1 2 3
4
5
14