Forum: C++ 27 Days Ago |
| Replies: 3 Views: 244 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++ 27 Days Ago |
| Replies: 3 Views: 244 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++ 29 Days Ago |
| Replies: 1 Views: 282 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: 225 thanks alot for explaining! |
Forum: C++ Oct 8th, 2009 |
| Replies: 4 Views: 225 will atoi(text[0]) work too?
because doing atoi("0") is hardcoding.... |
Forum: C++ Oct 8th, 2009 |
| Replies: 4 Views: 225 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: 350 i++ or i+= will not work because the compiler doesnt allow such operations for enum iterations |
Forum: C++ Aug 12th, 2009 |
| Replies: 5 Views: 350 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: 350 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,204 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,204 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: Java May 12th, 2009 |
| Replies: 3 Views: 498 I am doing a game and I need to reset the graphics back to its original picture once a new game begins, however when I click the new game button, everything else resets but the graphics do not even... |
Forum: Java May 5th, 2009 |
| Replies: 7 Views: 633 I guess I gotta post my whole code to let u guys understand....
Main Frame code:
public class MainFrame extends JFrame {
public static void main(String[] args) {
... |
Forum: Java May 5th, 2009 |
| Replies: 7 Views: 633 yes I knida want to have a Jpanel which paints inside a Jpanel in a JFrame. The painting works when inside just a JFrame but doesnt when I put it inside a JPanel |
Forum: Java May 5th, 2009 |
| Replies: 7 Views: 633 i did not post myPanel class because I know that it is working perfectly when I tested it. I cant possibly post my whole code here, unless someone wants to do my homework for me:). There is a... |
Forum: Java May 5th, 2009 |
| Replies: 7 Views: 633 I need to do paint a graphics into a nested panel. I am able to paint in a frame but when I add the class for painting into another JPanel, I see nothing.
I know how to create nested panels but... |
Forum: Java Apr 18th, 2009 |
| Replies: 1 Views: 351 ok so I need to use a 2d array to draw a hangman picture for a hangman game. the picture should be something like this
============
|<space>|
|<space>O
|<space>/|\
|<space>/\
|
|
but when i... |
Forum: C++ Feb 24th, 2009 |
| Replies: 1 Views: 666 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,097 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,097 hmm i removed those braces and got the same results as I posted before. |
Forum: C++ Feb 16th, 2009 |
| Replies: 8 Views: 1,097 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,097 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,097 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: 816 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: 816 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: 816 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: 816 oh didnt notice i copied the code twice lol just ignore the copied one |
Forum: C++ Feb 7th, 2009 |
| Replies: 11 Views: 816 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: 616 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: 616 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: 586 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: 616 |
Forum: C++ Feb 3rd, 2009 |
| Replies: 7 Views: 616 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: 616 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: Shell Scripting Jan 27th, 2009 |
| Replies: 7 Views: 2,068 function report
{
clear
echo "Name, Position, Department, Salary"
echo "========================================"
awk 'BEGIN{FS=","; RS="\n"} {printf "%s, %s, %s, %s\n", $1, $2, $3, $4}'... |
Forum: Shell Scripting Jan 26th, 2009 |
| Replies: 7 Views: 2,068 sorry bout that....my net got dc-ed halfway thru posting and i copied my whole post, didnt realise that code tags wont appear when copied...
anyway i tried taking off the $ sign but it still gives... |
Forum: Shell Scripting Jan 26th, 2009 |
| Replies: 7 Views: 2,068 #5report
function report
{
clear
echo "Name, Position, Department, Salary"
echo "========================================"
awk 'BEGIN{FS=","; RS="\n"} {printf "%s, %s, %s, %s\n", $1, $2, $3,... |
Forum: Shell Scripting Jan 18th, 2009 |
| Replies: 5 Views: 744 ok so I tried this on my data file which contains records:
Name, Dept, Job, Pay
John, Finance, Accountant, $2000
read -p "Enter name of Employee to Remove?: " remEmp
tr -d "grep -n -i $remEmp... |
Forum: Shell Scripting Jan 18th, 2009 |
| Replies: 5 Views: 744 thanks that helped alot
by the way, if i want to say delete a line of record, can i use the
tr -d?? Because I have been searching the Bash commands and havent found and delete command for shell... |
Forum: Shell Scripting Jan 18th, 2009 |
| Replies: 2 Views: 727 ok what i need to do is to make a script function which allows me to change the records in a file. I read some other posts about using sed but i still could not get it to work. The function runs But... |