Search Results

Search: Posts Made By: Luke Bonham
Forum: Programming 06-18-2011
6,226
Posted By Luke Bonham
Hi Loic, tanks for your reply. So I...
Hi Loic, tanks for your reply.



So I suppose doing it the opposite way is not correct, but why?

My graph is undirected and this is the operation I'd like to be the most efficient.
Forum: Programming 06-18-2011
1,141
Posted By Luke Bonham
[C] seeking good books
I suppose everybody here read reference books like Kernighan & Ritchie one, but where's the real deal?

I mean I'd like to learn more about special efficient techniques, tips&tricks, what compiler...
Forum: Programming 06-18-2011
6,226
Posted By Luke Bonham
Oh, you're right. :p /* edge */ typedef...
Oh, you're right. :p


/* edge */
typedef struct edge
{
int key, /* node v of edge uv */
struct edge *next;
} edge;

/* graph */
typedef struct graph
{
...
Forum: Programming 06-17-2011
6,226
Posted By Luke Bonham
[C] deleting node from graph
Using adjacency lists, I implemented this operation as follows:


/* remove the first node it finds with value 'val' in L list */
edge *removeEdge (edge *L, int val)
{
if( !L ) return...
Forum: Linux 05-10-2011
3,244
Posted By Luke Bonham
grub2 startup freeze
I got a dual boot with grub2, but everytime I turn on the computer and the booter is loaded, I can't handle the menu, so I am forced to wait the countdown and choose the default option.

I'd really...
Forum: Programming 03-30-2011
2,699
Posted By Luke Bonham
Don't know why but I thought it was just C. I...
Don't know why but I thought it was just C. I didn't know that was windows code. I'm totally uneducated about that.

I learned there's no "standard" way for this. Which is the answer to my...
Forum: Programming 03-29-2011
2,699
Posted By Luke Bonham
chill!
The windows system call stuff was just an example to introduce my question.

I've asked if there's a way to do this in C, standard, independently from the os.

Uhm, we can say my question is...
Forum: Programming 03-28-2011
2,699
Posted By Luke Bonham
[C] Is there a way to clean half screen?
Hi,
I wrote a program for Windows environment. It shows a menu to choice some operations to do. Once an operation is done, it cleans the screen with a system("cls") call, and the menu is shown...
Forum: Programming 07-04-2010
2,121
Posted By Luke Bonham
Yeah, those forgot "struct" in functions...
Yeah, those forgot "struct" in functions signatures. A very beginner's error.



Right.

Thank you all.

Edit:

Since my real problem is that I need real code instead of examples to get a...
Forum: Programming 07-03-2010
2,121
Posted By Luke Bonham
c - problem with headers?
I have a simple program to create a poker deck, shuffle it and deal cards. Here it is:

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

struct Card {
char *face,
*suit;...
2,635
Posted By Luke Bonham
Yeah I expressed myself bad, however I think to...
Yeah I expressed myself bad, however I think to understand.

Thanks for the help.
2,635
Posted By Luke Bonham
I mean is there some other selection command to...
I mean is there some other selection command to combine with "$1" argument in the for loop?
2,635
Posted By Luke Bonham
Really cool man! So using a for argument...
Really cool man!

So using a for argument like this not only list $1 files, but also moves the control in $1 directory, and could be specified which file type must be selected.

Some questions...
2,635
Posted By Luke Bonham
As I wrote in the code first comment, this script...
As I wrote in the code first comment, this script must take two arguments, a pathname <path> and a directory <dir>, then it has to select every regular file with .c extension in <path> and to copy it...
2,635
Posted By Luke Bonham
bash problem with if
#!/bin/bash

# This script takes two arguments: <path> and <dir>. It has to copy in <dir>
#+ all regular files in <path> with .c extension containining at least one while
#+ instruction and one...
Forum: Programming 06-08-2010
2,057
Posted By Luke Bonham
How to check an input variable
Suppose we have a simple situation, like the following C++ instructions:

int x;

cout << "Insert x: ";
cin >> x;

while ( x-- < 0 ) ;

Of course, if it is written something different from...
Forum: Programming 06-01-2010
1,965
Posted By Luke Bonham
Java import problem
In a default package, there are BankTest.java and package bank wich contains Account.class .

// File: BankTest.java

import bank.*;

public class BankTest {

public static void...
Forum: Programming 05-29-2010
2,724
Posted By Luke Bonham
Glad to see you too, bigearsbilly. :D Thank...
Glad to see you too, bigearsbilly. :D

Thank you guys.
Forum: Programming 05-28-2010
2,724
Posted By Luke Bonham
linked list node with pointer to struct
Suppose to have:

struct Tstudent
{
string name, surname;

int matriculation_num;
};

struct Tnode
{
Tstudent* student;

Tnodo* next;
} L;I want to deference that "student"...
Forum: Programming 05-26-2010
21,847
Posted By Luke Bonham
Fixed as you suggested and now it works. Thanks.
Fixed as you suggested and now it works. Thanks.
Forum: Programming 05-23-2010
21,847
Posted By Luke Bonham
C++ no match for 'operator []'
I wrote a little students management program using structs, and when I try to compile it, an error appears:

luke@luke-desktop:~/Desktop/ProgII$ g++ recStudents.cc
recStudents.cc: In function...
2,331
Posted By Luke Bonham
Thanks man, I learned something new! :cool: ...
Thanks man, I learned something new! :cool:



Just because I'm new to scripting languages and like to experiment.

If you find this kind of stuff somewhere, please link me.
2,331
Posted By Luke Bonham
Ok it works, I just didn't use it properly. :-) ...
Ok it works, I just didn't use it properly. :-)

My latest version is:

#!/bin/bash

if [ $# -ne 2 ]
then
echo "script use: bash prova <dir> <dim>"
else
if [ -d $1 ]
then
...
2,331
Posted By Luke Bonham
Wow, my terminal reports nothing when I run it,...
Wow, my terminal reports nothing when I run it, even if surely there's something wrong; maybe this depends on my terminal version or what?

I simply corrected it with your lines:

#!/bin/bash
...
Forum: Programming 05-15-2010
1,896
Posted By Luke Bonham
As far as I know, the ` operator is used to get...
As far as I know, the ` operator is used to get the value of a command result, you can assign it to a variable, for istance:

luke@luke-desktop:~$ a=`echo hello`
luke@luke-desktop:~$ echo $a...
Showing results 1 to 25 of 27

 
All times are GMT -4. The time now is 03:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy