Forum: C++ Oct 26th, 2009 |
| Replies: 3 Views: 265 ohh....I didnt include the setprecision and std::fixed. But if I include it, my code still doesnt print right. 500.00 as a string the float just becomes 50000.00
This is exactly what I did in my... |
Forum: C++ Oct 26th, 2009 |
| Replies: 3 Views: 265 I am trying to convert a string "500.00" into float.
When I use this it produces a string 50000, why does it produce such a result?
atof(bal.c_str()); |
Forum: C++ Oct 24th, 2009 |
| Replies: 1 Views: 317 ok so I am trying to read in a file. Do some string checking. And output the counters. But somehow I think something is wrong with my strcmp. And I do not know where is the problem. Everything... |
Forum: C++ Oct 8th, 2009 |
| Replies: 4 Views: 251 thanks alot for explaining! |
Forum: C++ Oct 8th, 2009 |
| Replies: 4 Views: 251 will atoi(text[0]) work too?
because doing atoi("0") is hardcoding.... |
Forum: C++ Oct 8th, 2009 |
| Replies: 4 Views: 251 I got a question about c++ strings.
Let's say string text = "0R14"
and I access each element using text[0],text[1] etc
does text[0] return an integer 0? or a character '0'?
if it doesn't... |
Forum: C++ Aug 13th, 2009 |
| Replies: 5 Views: 365 i++ or i+= will not work because the compiler doesnt allow such operations for enum iterations |
Forum: C++ Aug 12th, 2009 |
| Replies: 5 Views: 365 by the way this is my main when I run the program for testing
int main()
{
print_shortest_path(changi, bedok);
system("pause");
} |
Forum: C++ Aug 12th, 2009 |
| Replies: 5 Views: 365 I am doing a program to print out the shortest path between locations. I implemented it using a 2D array for the adjacency matrix.
However, when I run it and input the start and end locations,... |
Forum: C++ Aug 12th, 2009 |
| Replies: 3 Views: 1,436 so C doesnt have bool defined that's why they need to define it like that? |
Forum: C++ Aug 12th, 2009 |
| Replies: 3 Views: 1,436 what's wrong with this line when I try to compile in C++?? The src code was originally in C. It gets an expected identifier error with my c++ compiler
typedef enum {false, true} bool; |
Forum: C++ Feb 24th, 2009 |
| Replies: 1 Views: 681 So basically I am creating a client/server kind of program. The client/user enters a question eg "Who are you? "
The server part receives this and checks it with a txt file and returns eg "I am a... |
Forum: C++ Feb 17th, 2009 |
| Replies: 8 Views: 1,139 forgot to mention that in my above post, but i tried putting the braces as you advised too. Both removing and changing the position of the braces resulted in the program doing nothing. Im not new to... |
Forum: C++ Feb 17th, 2009 |
| Replies: 8 Views: 1,139 hmm i removed those braces and got the same results as I posted before. |
Forum: C++ Feb 16th, 2009 |
| Replies: 8 Views: 1,139 ok so now my code compiles properly. However, it doesnt work. I am able to input a question like How are you?
but nothing else happens. It should be able to create a fork and the server side of my... |
Forum: C++ Feb 15th, 2009 |
| Replies: 8 Views: 1,139 the error is the recv_data type is not the same as my vector strings (qns and ans). So I am unable to string compare. And this is kind of a problem for me |
Forum: C++ Feb 15th, 2009 |
| Replies: 8 Views: 1,139 So, what Im trying to do here is a client server socket program. The client will ask a question to the server. For example, How are you?
Then the server opens a text file, compares the string from... |
Forum: C++ Feb 8th, 2009 |
| Replies: 11 Views: 826 thanks for the help so far. I have changed all my test functions and all of them work except for counting the total size of files in bytes. I know that strings do not allow integer calculations. So,... |
Forum: C++ Feb 8th, 2009 |
| Replies: 11 Views: 826 ok here's my updated and corrected code. Compiles fine. But when I run the command ls -ali | ./a.out in Unix, I get a segmentation error. Am I missing a library?
#include <iostream>
#include... |
Forum: C++ Feb 8th, 2009 |
| Replies: 11 Views: 826 oh I did that because of an example I saw. And it's the only example out there which is in line with what I want to do...
which is the break the input line into different fields and check only... |
Forum: C++ Feb 8th, 2009 |
| Replies: 11 Views: 826 oh didnt notice i copied the code twice lol just ignore the copied one |
Forum: C++ Feb 7th, 2009 |
| Replies: 11 Views: 826 I did a program to read the output of the UNIX command ls -ali
and count the number of directories, write files, link files etc.
But there seeems to be something wrong with my code and I cant... |
Forum: C++ Feb 5th, 2009 |
| Replies: 7 Views: 637 ok so i came up with this code, seems that I have a compilation error and I cant seem to figure out why
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char... |
Forum: C++ Feb 5th, 2009 |
| Replies: 7 Views: 637 so there is no other functions to find out the file type (dwrx) other than to check the string (dwrx etc...) if im not allowed to use stat functions?
because if this is the situation, and I... |
Forum: C++ Feb 4th, 2009 |
| Replies: 1 Views: 603 hi guys its my first time doing a c++ program to manipulate shell input
I need to create a c++ program which reads input from this unix shell command >> ls -ali
and then im supposed to count the... |
Forum: C++ Feb 4th, 2009 |
| Replies: 7 Views: 637 |
Forum: C++ Feb 3rd, 2009 |
| Replies: 7 Views: 637 so to clarify, will mode_t work if I use it with pre defined macros such as S_IFDIR , S_IFLNK , S_IRUSR ?? or is it a must to use them with st_mode??
for example if I wanna do a file checking... |
Forum: C++ Feb 2nd, 2009 |
| Replies: 7 Views: 637 Hi guys I just wanna ask what is the difference between the mode_t and st_mode when using sys/stat.h and sys/types.h libraries. I looked them up google and find most people use st_mode but never... |
Forum: C++ Nov 21st, 2008 |
| Replies: 5 Views: 1,595 |
Forum: C++ Nov 20th, 2008 |
| Replies: 5 Views: 1,595 ok what im trying to do have a list of Events (which are actually a struct type containning data such as time date etc). And my problem as can be seen above is that I do not know how to resolve their... |
Forum: C++ Nov 20th, 2008 |
| Replies: 5 Views: 1,595 I am creating a linked list which links a struct of data together. However, this is my problem, if I declare struct Node first then the Event type wont exist, but if I declare struct Event first then... |
Forum: C++ Nov 17th, 2008 |
| Replies: 6 Views: 422 oh dang didnt notice i used cout twice...must be the stress...
and its working now :) thanks all for the help |
Forum: C++ Nov 17th, 2008 |
| Replies: 6 Views: 422 ok so...i did something about the display functions and got this but it doesnt seem to work....
can someone explain how a function from another class calls a function for a diff class??....coz i... |
Forum: C++ Nov 17th, 2008 |
| Replies: 6 Views: 422 ok basically what my program is about. I am to create a program that allows users to input aircraft/cargo details, add the cargo to the aircraft(up to 20), and a function to display all the cargo on... |
Forum: C++ Nov 4th, 2008 |
| Replies: 8 Views: 734 this is very weird LOL
i deleted the #include <cstring> and the ' ' around *text
IT WORKED! soooo weird |
Forum: C++ Nov 4th, 2008 |
| Replies: 8 Views: 734 invalid conversion from `char**' to `int' |
Forum: C++ Nov 4th, 2008 |
| Replies: 8 Views: 734 ok i tried that and......it created another error.... |
Forum: C++ Nov 4th, 2008 |
| Replies: 8 Views: 734 so correct me if im wrong...i read the text file, then put the characters into an array, and im pretty sure *text in check = isalpha('*text'); refers to a single array element....
ahhh....still... |
Forum: C++ Nov 4th, 2008 |
| Replies: 8 Views: 734 ok so what im trying to do is to read some text from a file. Put them into an array. And count the number of characters in the text file using pointers to access the array. However, when i compile i... |
Forum: C++ Oct 14th, 2008 |
| Replies: 9 Views: 2,937 thanks Ancient Dragon for explaining.
however i tried creating a tm structure outside the int main() function and it always doesnt work. It seems to only work in int main(). I can't figure out... |