4 Replies - 1230 Views - Last Post: 17 January 2012 - 01:10 PM

#1 waleed95  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 15-December 11

How do I Write A Program in Which...

Posted 16 January 2012 - 02:06 AM

I take a certain number of source files and add a line of code to each (the same on each). How would you go about doing this and what language would you use? This is not homework. Thanks in advance.
Is This A Good Question/Topic? 0
  • +

Replies To: How do I Write A Program in Which...

#2 tlhIn`toq  Icon User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6507
  • View blog
  • Posts: 14,373
  • Joined: 02-June 10

Re: How do I Write A Program in Which...

Posted 16 January 2012 - 02:11 AM

I'd do it in C#. WPF is the new standard. WinForms is faster for me at the moment.
So I'd probably try to do it in WPF for the practice.


Newbie/Rookie said:

I have a little programming experience but I need to write ...


You need to start there. I can't say "I have little experience in speaking Russian, but I have been assigned to write a mystery novel in Russian. Can you help me?"

We can help you by saying "First learn basic programming and the language of C#. Then take on assignments." Could someone here write this program for you? Sure. Could someone here map out all the processes you need to follow and do the Software Design part of this in the slim hope you could code it from there? Sure. But we don't volunteer to do the job that you're either getting paid for, or getting a grade for. You may want to read this.

For now, just work on the lessons. Do a self-teaching book from cover to cover. Then consider writing a program.

Don't try to create a useful working program to fit a need of yours (or a for-pay contract) as your introduction to coding project. When you are learning to code you don't know enough to code a program, let alone know how to engineer the architecture of a program. It would be like saying "I don't know how to read sheet music, or play an instrument. I think I'll write a 3 act opera as my first learning experience."

I don't say this to be mean. We've seen lots of new coders take this approach and we know it doesn't work. Trying to design your own programs before you understand the basics of the code language you've chosen just leads to problems, frustrations, and 'swiss-cheese' education (lots of holes).


Resources, references and suggestions for new programmers. - Updated Jan 2012
Spoiler


View Postwaleed95, on 16 January 2012 - 03:06 AM, said:

How would you go about doing this [...]


I don't want you to write my code, just give me ideas on how to solve my problem.

What have to you tried to code so far?
What part of what you have tried isn't working?
Are you getting error messages, or is it just not giving you the results you wanted?

(In other words, you at least have to make and show us your good faith effort to do your own coding. We are here to help you, not do it for you.)
What does this error mean?

Suggestion:
Don't replace lines of code that don't work. Instead comment them out and put your new attemps below that. This will keep you from re-trying the same ideas over and over. Also, when you come back to us saying "I've tried this 100 different ways and still can't get it", we can actually see what you tried. So often a failed attempt is very very close and just needs a little nudge in the right direction. So if we can say "See what you did in attempt 3... blah blah" it helps a lot

// Try #1 - May 1, 0900hrs
//    code
//    code  
//    code
// Try #2 - May 2, 1700hrs   Okay, plan B.  What if I do it *this* way
//    code
//    code  
//    code
// Try #14 - May 3, 0500hrs after 5 cans of RedBull.  Maybe I should get some sleep. I can't think of anything else but this last idea
    code
    code  
    code


If you are using Visual Studio you can select a block of lines and hit control+k control+c (Kode Comment) to comment it out. control+k control+u (Kode Uncomment) to uncomment a selected block.
Was This Post Helpful? 2
  • +
  • -

#3 waleed95  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 15-December 11

Re: How do I Write A Program in Which...

Posted 16 January 2012 - 02:21 AM

My plan wasn't to just jump into making this, I already have lots of experience with C++ and I want to learn a new language which is useful for day-to-day stuff, that's why I asked what language you would use. Thanks for all the resources and help. P.S. I wish this program would make me money.
Was This Post Helpful? 0
  • +
  • -

#4 stackoverflow  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 166
  • View blog
  • Posts: 545
  • Joined: 06-July 11

Re: How do I Write A Program in Which...

Posted 16 January 2012 - 10:29 AM

If you are hell bent on a new language.

* Perl
* Python
* Awk
Was This Post Helpful? 1
  • +
  • -

#5 jon.kiparsky  Icon User is online

  • Chinga la migra
  • member icon


Reputation: 10686
  • View blog
  • Posts: 18,302
  • Joined: 19-March 11

Re: How do I Write A Program in Which...

Posted 17 January 2012 - 01:10 PM

Since you asked, I'd do that in perl, but you could also use sed or awk. Python presumably would work as well, but I'm more of a perl guy for this sort of thing.
Could do it with bash, if the line goes at the end of the file. (cat >>)

I definitely wouldn't do it in Java or C# or any other heavyweight language unless I really wanted something that had more functionality than you're describing. Elephant guns for mosquitos, not my style.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1