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

[ad_1] 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] C, read a binary file?

[ad_1] Use rb (read binary) as mode parameter in the fopen() function. For more information: http://www.cplusplus.com/reference/cstdio/fopen/ [ad_2] solved C, read a binary file?

[Solved] Needed help i C

[ad_1] 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 … Read more

[Solved] Pointer char output explanation

[ad_1] 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 … Read more

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

[ad_1] 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 = … Read more

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

[ad_1] 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. … Read more

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

[ad_1] 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 [ad_2] 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]

[ad_1] 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?

[ad_1] 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 … Read more

[Solved] C++ sum char and integer

[ad_1] 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’ [ad_2] solved C++ sum char and integer

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

[ad_1] 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 … Read more