• Register
search
Log In

Recent questions tagged c

1 vote
1 answer 6 views
Problem: I need to cast only one char to string. The opposite way is pretty simple like str[0]. The following did not work for me: char c = 34; string(1,c); Do you guys have any idea how can I convert a character into a string? I would be grateful if you could solve the issue. I’ve already spent thirty minutes on this. Please, someone, come ahead and save my day. Thanks.
asked Jun 24 adamSw 9.9k points
0 votes
1 answer 3 views
Problem: Hello Kodlogs, I am a beginner of c++ programming, as well as a new member of this forum. I am having an issue with typecasting. I wonder if I can convert a decimal value to hexadecimal using a c++ program. How can I do it? Could you please suggest me an easy way to do that? I appreciate your effort a lot. Thanks.
asked Jun 24 adamSw 9.9k points
1 vote
1 answer 16 views
Problem: Hello Kodlogs, I am a pretty new student in computer programming. I started the journey with c++ language. I just get around some things about the vector of c++ programming. Suddenly, I’ve got a question in my mind if I can access the last element of a ... last item. So, how do you do that? I hope you guys will shed some light on this question and help me to understand. Thanks.
asked Jun 23 adamSw 9.9k points
0 votes
1 answer 5 views
Problem: Well, I am a beginner of c++ programming. I just wanted to know how do you people copy one vector to another in the fastest way? I've written a program to do that. I am attaching the codes below. void copyVecFast(vec<int>& original) { vector<int> newVec ... this is not the right and fastest way to do business. I would love to see your codes to the same thing in your style. Thanks.
asked Jun 23 adamSw 9.9k points
0 votes
1 answer 6 views
Problem: Hello all, I was solving my mathematics textbook problems and wondering if we can write codes and create a program to solve each problem. Let's say I want to find out or calculate the distance between two places applying the formula of the Pythagorean ... distance using the above formula. Note: Please say something in C++, because I only undersatnd that language a little bit. Thanks.
asked Jun 23 adamSw 9.9k points
0 votes
1 answer 12 views
Problem: I am trying to develop a game using the c++ programming language. My main.cpp block is producing an error. I am attaching that portion here. Please have a look at it and help me to fix the error. void main (){ const long_tab = 2000; int t[long_tab]; ... ;t add them here. As far as I am sure about the error producing block I attached the block. I look forward to have your solutions.
asked Jun 22 adamSw 9.9k points
0 votes
1 answer 10 views
Problem: I have a main.cpp file and a bunch of other CPP files and header files that are included in the main.cpp. In the header files, I have already used #indef, #define, and #endif in the right place and I also included the header files in main.cpp. However ... codes that I can understand at least. What&rsquo;s the wrong thing I&rsquo;ve done? ould any of you please make the things clear to me?
asked Jun 22 adamSw 9.9k points
0 votes
1 answer 7 views
Problem: Hello guys, I am new in the c++ although I know the basics of c but I am trying to implement is that takin the string from the user and converting it to the lower case, I don't know how to code this I have few things with ASCII value and stuff still, I am not able to get it, I am waiting for the solution of this problem.
asked Jun 21 Gavin 15.2k points
1 vote
1 answer 11 views
Problem: I just completed the String chapter from my text book and trying to operate some calculation on c++ String data type. So far, I&rsquo;ve succefully checked some cases and find the result as I learnt from this chapter. Now, coming to the main point, I want ... experts are contributing here. I am looking for those experts to answer my question and make it happen in an easy way. Thanks all!
asked Jun 21 adamSw 9.9k points
1 vote
1 answer 13 views
Problem: I have just completed reading the vector chapter from my c++ programming textbook. I completely understand how a vector works. I was about to start the exercise solving and got a problem says to initialize a 2d vector using c++ programming language, and that ... 2D vectors. Could you please help me to write the program with an example? I am looking forward to reading your answers. Thanks.
asked Jun 20 adamSw 9.9k points
0 votes
0 answers 8 views
Problem: I have recently started learning the C Programming. Currently I am trying to write C programs. In this coding problem I am trying to count the number of characters, newlines and number of words. But I think there is some issue in the second while loop which I am unable to ... ();                 nc++;             }             nc++;         }     }     printf("%d %d %d",nl,nc,nw); }
asked Jun 16 Raphael Pacheco 720 points
1 vote
1 answer 9 views
Problem: Hello all, I am struggling to solve a problem for the last thirty minutes using the c++ programing language. I was thinking of writing a program that will read the defined string and iterate through it and print all the words separately. Suppose I initialize a string with ... it very much How do you it or suggest me an easy way to do that. I look forward. Thanks for your kind assistance.
asked Jun 15 adamSw 9.9k points
1 vote
1 answer 13 views
Problem: Hello sir this question was asked in the campus interview that given a integer value as a input how can you convert it to hexadecimal value,I came up with the solution still the output is not the exact which it should can you please know us the solution. #include <iostream> int main() { ... } else { std::cout << remainder; } dec = dec / 16; } }This is what, I have done so far in my code.
asked Jun 2 Gavin 15.2k points
1 vote
1 answer 14 views
Problem: I am new to c++ language, i dont know when i was printing character data by int it dint give the character instead it give me the number so my question is how can i convert it in char and display the output.If you know the solution please le me know.I am waiting for the response.
asked Jun 2 Gavin 15.2k points
1 vote
1 answer 12 views
Problem: Hello Kodlogs, I am a new C++ student. I am planning to build a program that can extract all the numbers for the given string. Let's say if the string value is "1: 2 3 - 4/ 5 something" then it should bring out all the numbers from it and display ... me. Could any of you please help me to find the solution? I am looking forward to hearing from you guys. Many thanks for your kind concern.
asked May 31 adamSw 9.9k points
1 vote
1 answer 10 views
Problem: I have created a struct in my program. This is how it looks like: struct a{ a(){}; a(int one,int two): a(one),b(two){}; int a; int b; int c; } a * b; cout << b->c; When I am trying to read the value of c it causes an error of: unable to read memory and the program crashed immediately. What causes this error? Could you please shed some light on this?
asked May 31 adamSw 9.9k points
1 vote
1 answer 10 views
Problem: I have been trying to make a number guessing game using the c++ programming language. My aim is to produce random numbers and the user will make a random guess and provide a number by assuming it in the range of 1-100. If the user can make the right guess it will print you ... if (guess > the_number){ cout << "It's Lower"; tries++; } else cout << "That's not even in range!"; return 0;
asked May 30 adamSw 9.9k points
1 vote
1 answer 18 views
Problem: I am learning the c++ programming for the last week. I&rsquo;ve been trying to execute my program but it&rsquo;s encountering some error. It&rsquo;s showing something like this: &ldquo;identifier string is undefined&rdquo; This problem is encountering when I tried ... integer, it worked just fine: Could somebody help me on this point? I am looking forward to having your answers. Thanks.
asked May 30 adamSw 9.9k points
1 vote
1 answer 12 views
Problem: What is an undefined reference to a function in c++ programming? I have been trying to calculate some values using my user-defined function in my program for hours. My simple c++ program is not producing the output as it is supposed to do instead of that encountering an error of: ... << "Substracted value is :" << subResult << endl; return 0; } int sum(int a, int b){ return a + b; }
asked May 29 adamSw 9.9k points
1 vote
1 answer 13 views
Problem: I am trying to create functions and use them in my c++ codes. I have created a function to add to integer numbers in a function. But the function is not working as it is supposed to do. I am attaching the code snippet below. Below have a look at my code and fix the ... int sum(int a, int b) { int result; result = a + b; return (result); } Please note that I am a newbie in programming.
asked May 29 adamSw 9.9k points