[Solved] How to loop to get floating-point only? [duplicate]

I have no idea what half of your code means, but here is your solution. I don’t understand why you have a while loop after main? Many other “Why’s?” , but here is the code: #include<iostream> #include<string> #include<sstream> using namespace std; int main() { string input = “”; int number = 0; while (true) { … Read more

[Solved] Needed help i C

given this code: void matr(int arr[max][max], int n, int m) { int i; int k; for (i = 0, k = m * n; i < k; i++) { arr[i / m][i % m] = rand() % 10 * (pow(-1, rand() % 10)); } } here is an explanation: 1) MAX must be a #define … Read more

[Solved] Pointer char output explanation

OK, I will try to explain this as simply as I can. When you do: putchar(*pch++) what you say is ‘print that character of the address that pch points to and then increment the pch to point to the next address’. Essentially, before the first putchar(), *pch=”a” and after *pch=”b”(because pch points now to ch[1]). … Read more

[Solved] How to pass array to method [closed]

make it into an ‘out’ parameter and all should be well: private void x() { string sTestFile = “this is a test”; string[] TestFileWords; FixConcatString(sTestFile, out TestFileWords); } private void FixConcatString(string splayfile, **out** string[] sWordArray) { char[] charSeparators = new char[] { ‘-‘ }; splayfile = splayfile.ToLower(); splayfile = splayfile.Replace(@”\”, ” “); sWordArray = splayfile.Split(charSeparators, … Read more

[Solved] Too many arguments to function call, What do I do?

In your function definition float remainingAngle(float answer) the function remainingAngle() accepts one parameter. OTOH, in your function call remainingAngle(angleA,angleB); you’re passing two arguments. The supplied argument number and type should match with the parameter list in function definition. That said, your code is wrong. Point 1. Your local variables will shadow the global ones. Maybe … Read more

[Solved] File.Exists is working in C#, but doesn’t work in VB.NET

Try this way: Dim stringData As String = GetFolderPath(SpecialFolder.MyDocuments) & “\my.exe” ‘For example If Not String.IsNullOrEmpty(stringData) Then If File.Exists(stringData) Then Process.Start(stringData) Else MsgBox(“File couldn’t be found.”, vbCritical, “MyApp”) End If End If solved File.Exists is working in C#, but doesn’t work in VB.NET

[Solved] Using int main(int argc, char **argv) in c++ [closed]

You haven’t actually provided code that exhibits your problem but, to answer your question, ways to pass argv[2] as a string to a function include #include <cstring> #include <iostream> void func(const char *s) { // treat s as a zero terminated string if (std::strcmp(s, “Hello”) == 0) { std::cout << “You said hello\n”; } } … Read more

[Solved] Is the c# a functional or object oriented language?

From wikipedia: C# is a multi-paradigm programming language encompassing strong typing, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines So, in general, we can just use whichever paradigm suits our needs for the task at hand. UPDATE: A couple of caveats have been highlighted by the comments below: It is primarly intended to … Read more

[Solved] C++ sum char and integer

Here s will be “3xzy1” as s[2]=’x’+2; makes s[2] equal to ‘z’, where ‘z’ is a character, not a string. ‘x’-1==’w’; ‘x’+1==’y’; ‘x’+2==’z’ solved C++ sum char and integer

[Solved] C++ How to remove 0 values from array without using vector

I still prefer using std::vector although this question mentions “without using vector”. But let’s just try doing so with array anyway. int int_array[20] = {/*…*/}; int* last_ptr = std::remove(std::begin(int_array), std::end(int_array), 0); for (int* it = int_array ; it != last_ptr ; ++it) cout << *it << endl; As convention, the resulting last_ptr points to the … Read more