Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,574 members, 7,820,065 topics. Date: Tuesday, 07 May 2024 at 09:13 AM

I Want To Learn Programming. Which Language Should I Start With? - Programming (54) - Nairaland

Nairaland Forum / Science/Technology / Programming / I Want To Learn Programming. Which Language Should I Start With? (660792 Views)

As A Computer Science Student,which Language Should I Start Learning / Which Programming Language Should He Go For? / I Want To Learn Computer Programming, What Language Should I Learn First? (2) (3) (4)

(1) (2) (3) ... (51) (52) (53) (54) (55) (56) (57) ... (165) (Reply) (Go Down)

Re: I Want To Learn Programming. Which Language Should I Start With? by Mathemagician1(m): 9:21am On Dec 31, 2015
printf("Hello C-Programmers, i need your help. \n" );

I am new to C-programming actually and I plan to be a kickass programmer someday but i'm having a problem writing my very first program. It's an automated coffee shop menu. So far i have been able to write the first phase of the program. My problem however is being unable to set the loop such that the menu re-present itself in case the customer intends to make extra orders.

I want you all to help me be a better programmer. Teach me please.

Sincerely,
Mathemagician1

This is my code so far.

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

int main()
{
int cost = 0;
int UserChoice = puts("Please select your Menu: \n 1 - Black Coffee \n 2 - Cream coffee \n 3 - Coffee a la carte \n" );
scanf("%i", &UserChoice);
switch(UserChoice)
{
case 1:
cost = 50;
break;
case 2:
cost = 70;
break;
case 3:
cost = 100;
break;
default:
cost = 0;
printf("This is an invalid command. \nPlease select an order from the main Menu. \n" );
break;
}

printf("Your bill is %i Naira. \nThank you for shopping with us.\n", cost);
return 0;
}
Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 9:37am On Dec 31, 2015
Mathmagician1, you'll have to do two things:

1. Wrap int UserChoice and the switch statement in a while loop... while(1) will probably be the simplest implementation.
2. Figure out how you want to break the while loop after the user is done making their selections.

I recommend you keep int cost out of the the while loop, that way you can access the value and print it in the printf statement at the end (the printf statement would also be outside the while loop).

That would be the simplest solution. You'll have to do a little more than that though, if you want to fool-proof the program.
Re: I Want To Learn Programming. Which Language Should I Start With? by Mathemagician1(m): 10:07am On Dec 31, 2015
ChinenyeN:
Mathmagician1, you'll have to do two things:

1. Wrap int UserChoice and the switch statement in a while loop... while(1) will probably be the simplest implementation.
2. Figure out how you want to break the while loop after the user is done making their selections.

I recommend you keep int cost out of the the while loop, that way you can access the value and print it in the printf statement at the end (the printf statement would also be outside the while loop).

That would be the simplest solution.

Thank you for your help sir, i really do appreciate but i have been trying the while loop since last night but i still can't get it. Please if you could show me an example i'll be more than grateful and most importantly it will help me understand while loop better.

I still have other aspect in my flowchart that intend to add to the program, like re-presenting the menu when the customer fail to enter the right integer.

Thank you once again for your help.
Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 10:27am On Dec 31, 2015
I reworked your code a little to show you what a bit of fool-proofing might look like. Some key changes:

1. I replaced the puts with printf for the sake of adding "\n\n[selection]> ". When you compile and run the code, you'll understand why I opted for printf over puts, in this instance.
2. I added a new header file <stdbool.h> to enable the use of boolean (true/false) variables.
3. I added a new menu option (4 - Finished) to simplify the work needed to break the loop
4. I assumed you will want to print a total or sum of all selections for the bill, so I included the += operator which is equivalent to saying "cost = cost + number"

If there's anything else you feel needs explaining, don't hesitate to ask.

Re: I Want To Learn Programming. Which Language Should I Start With? by Mathemagician1(m): 10:47am On Dec 31, 2015
ChinenyeN:
I reworked your code a little to show you what a bit of fool-proofing might look like. Some key changes:

1. I replaced the puts with printf for the sake of adding "\n\n[selection]> ". When you compile and run the code, you'll understand why I opted for printf over puts, in this instance.
2. I added a new header file <stdbool.h> to enable the use of boolean (true/false) variables.
3. I added a new menu option (4 - Finished) to simplify the work needed to break the loop
4. I assumed you will want to print a total or sum of all selections for the bill, so I included the += operator which is equivalent to saying "cost = cost + number"

If there's anything else you feel needs explaining, don't hesitate to ask.

grin Reading your algorithm was sweet, that was very logical i understand everything now. I will want to be like you when i grow up.

Thank you very much.
Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 11:34am On Dec 31, 2015
No problem. Glad I could help.

1 Like

Re: I Want To Learn Programming. Which Language Should I Start With? by mrcobuh: 5:58pm On Dec 31, 2015
Each item on this list cost just ₦500 and that is fair

Videos

Android App Programming
IOS App Programming
Codeigniter
C++ Programming from beginner to advanced
C# Programming from beginner to advanced
Java Programming from beginner to advanced
Hacking Tips
HTML5 and CSS3
Learning Responsive Web Design
ASP.NET
Php & Mysql from beginner to advanced
Javascript
XHTML and CSS
XML
JSON
AJAX
jQuery
Wordpress essential training

Ecommerce Videos
Wordpress woocommerce
Magento
Opencart

Others
Each in this category cost 1200
All about SEO and marketing
60 premium Joomla Themes
170 Joomla Templates
Tutorialpoint offline
W3Schools offline
237 Wordpress Themes + 22 Wordpress plugins + 150 woocommerce plugins
Ciscos materials
Google Adsence and blogging video
laptop repair videos

Call 08032680291 to negotiate now
There is a discount if you buy more than 8

Collection Points
Berger, lagos State
Akute and Sagamu, Ogun state
Any Bus Stop of your choice
Re: I Want To Learn Programming. Which Language Should I Start With? by Mathemagician1(m): 8:09pm On Jan 02, 2016
Printf("Hello C-Programmers, /n/n" );

As the resident C-Programming trainee I've come with yet another newbie problem I've been struggling with and I'll want our in-house pros to help me out here. ‎

I'm trying to write a program that allows Users make input that searches through music tracks, gets the match and display the result. The good news is the program was able to search and present accurate results but I'm having 2 problems however:

[0] - The program cannot search double available strings. E.g 'left girl'. String 'Left' happens to be in track 1 while string 'girl' is in track 5. The program only presents result of the first string.

[1] - I don't want to leave an empty output when the search string isn't found. I want to be able to return "Track not found". I'm having difficulties doing this without getting it mixed up.

How can I resolve these problems? Any clue in this regard will be highly appreciated. Attached is my code.‎

Thanks in anticipation.‎
Cheers.
Cc: ChinenyeN

----------

#include <stdio.h>
#include <string.h>

char PlayList[][80] = {
"I left my heart in Havard med school",
"Newark, Newark - a wonderful town",
"Dancing with a dork",
"From here to maternity",
"The girl from Iwo Jima"
}; ‎

void FindTrack(char SearchFor[])
{
int i;
for(i = 0; i < 5; i++)
{
if (strstr(PlayList[i], SearchFor))
printf("Track %i: '%s' \n", i+1, PlayList[i]);
}
printf("Track not found. \n" );
}

int main()
{
char SearchFor[80];
printf("Search PlayList For: \n" );
scanf("%s", &SearchFor);
FindTrack(SearchFor);
return 0;
}
Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 2:00am On Jan 03, 2016
Taking this one problem at a time...

[0][0] scanf is a quick and useful way to get input, but it has limitations, and to be honest, a lot of developers tend to discourage the use of scanf, especially for people just starting out in C. Anyway, this is one instance in which scanf does not help you. This is because scanf scans input based on a format string, (i.e. "%s" ). So, with your program, it failed to search double strings, because scanf only scanned "left" and failed to scan "girl" (due to having a single conversion specifier "%s" ). Of course, naturally, you might be tempted to think that "%s %s" would solve your problems, but it won't. In fact, for this program, forget scanf and use fgets instead.

[0][1] fgets isn't a one-step solution, though. All fgets will do is get input from stdin, ensuring that both "left" and "girl" are read (as a single string). You then have to process/evaluate that input manually. There are a number of ways you could do this, but ultimately it will all depend on how you intend to use the data either during or after the evaluation process. The evaluation and a call to FindTrack could probably all be done in a single, not-too-complicated while loop, but it might be easier and also make more sense to you if you take the evaluation process step-by-step.

[1][0] You could probably use an if/else statement to print out "Track not found." The only downside to this would be that "Track not found" would be printed at each iteration in which the string is not found. So, if you search "left girl", "Track not found" will be printed out at least 3 times. Alternatively, you could include (in your FindTrack function) an int variable to switch from 0 to 1 if a track is found, or a boolean variable to switch from false to true. Then, after the for loop has run, wrap printf("Track not found.\n" ); in an if statement which checks to see if the int or boolean variable was switched from 0 to 1 or false to true, respectively before deciding whether or not to print out "Track not found.\n".
Re: I Want To Learn Programming. Which Language Should I Start With? by seunny4lif(m): 12:06pm On Jan 05, 2016
Hallo house, i beg i Need una help, I wan learn programming but i dont know which one is good pass between Java cry and PYTHON cry...
Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 10:11pm On Jan 05, 2016
seunny4lif:
Hallo house, i beg i Need una help, I wan learn programming but i dont know which one is good pass between Java cry and PYTHON cry...

Java and Python are simply tools, both of which you can use to do the same/similar things. The only true difference is how those things are done. Between the two, Python is easier to learn, but I would recommend Java. Java may be notoriously convoluted, but it teaches (or maybe, I should say enforces) some good programming habits, especially when it comes to OOP (object oriented programming). It's not to say that Python doesn't teach good programming habits. It's just that from my own personal opinion, the complicated nature of Java really exposes the OOP thought-process, which is something you'll need to understand if you plan on programming in either Java or Python, or any OOP language for that matter.

1 Like

Re: I Want To Learn Programming. Which Language Should I Start With? by seunny4lif(m): 11:11pm On Jan 05, 2016
ChinenyeN:


Java and Python are simply tools, both of which you can use to do the same/similar things. The only true difference is how those things are done. Between the two, Python is easier to learn, but I would recommend Java. Java may be notoriously convoluted, but it teaches (or maybe, I should say enforces) some good programming habits, especially when it comes to OOP (object oriented programming). It's not to say that Python doesn't teach good programming habits. It's just that from my own personal opinion, the complicated nature of Java really exposes the OOP thought-process, which is something you'll need to understand if you plan on programming in either Java or Python, or any OOP language for that matter.
Thank u but the problem is that I don't know anything about programming cry
I started the tutorial today but the whole thing look like cry cos na only hardware i know about computer...
The guy suggest java for me...
Na today I respect programmers chai grin
Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 2:23am On Jan 06, 2016
Don't worry. I'm sure you'll get it. Honestly, pogramming just takes thinking and knowing your tool (be it Java, Python, C, Lisp, etc).
Re: I Want To Learn Programming. Which Language Should I Start With? by Bollinger(m): 4:32pm On Jan 06, 2016
Can someone please help me out. In SQL, The operator sign for LESS THAN is < , and for EQUAL TO is =. My question is, what can I use in place of these two operators. I am being quizzed and I need an answer asap.
Re: I Want To Learn Programming. Which Language Should I Start With? by darkhorizon: 11:48pm On Jan 06, 2016
ChinenyeN:
Don't worry. I'm sure you'll get it. Honestly, pogramming just takes thinking and knowing your tool (be it Java, Python, C, Lisp, etc).
Hello,sir please help me out with looping:for loop,do-while,while . I am having a hard time getting the concept
Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 1:46am On Jan 07, 2016
darkhorizon:
Hello,sir please help me out with looping:for loop,do-while,while . I am having a hard time getting the concept
Loops are good for controlling the flow of a program. For example, let's say we have a program that is designed to make one of three decisions based on a set of data. Without any looping, the program will run once, probably meeting three if-statements (or maybe one if-elseif-else-statement) before finally closing. Now, if we had a program like that, but had 10 different sets of data, we would invariably have to run the program 10 times. However, looping solves that.

Looping basically runs a section of code multiple times. Back to our pseudo-program... adding a loop statement will allow us to run that decision-making process 10 times, iterating over each set of data before finally closing the program. The specific loop statement you use depends on what you know about the data you are trying to process.

A for loop is good when you know the number of items or number of times your program must repeat the same decision-making process.

A while loop is used when you have no way of knowing how many iterations will occur.

A do while loop is the same as a while loop, except it ensures that the decision-making process will run at least once, regardless of whether or not the loop itself runs. This can be very useful in certain cases.

1 Like

Re: I Want To Learn Programming. Which Language Should I Start With? by seunny4lif(m): 1:57pm On Jan 08, 2016
ChinenyeN:
Don't worry. I'm sure you'll get it. Honestly, pogramming just takes thinking and knowing your tool (be it Java, Python, C, Lisp, etc).
I don't know you don reply me sir
See what I try cry grin

Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 2:11pm On Jan 08, 2016
Seunny4lif

1. String () args .... should be ... String[] args
2. Java is case-sensitive... system.out.println() ... should be .. System.out.println().
3. Close the System.out.println() statement with a semicolon.. i.e. ;
4. I imagine you want to print the sum of a + b... so why not say ("a + b = " + c)

1 Like

Re: I Want To Learn Programming. Which Language Should I Start With? by seunny4lif(m): 3:11pm On Jan 08, 2016
ChinenyeN:
Seunny4lif

1. String () args .... should be ... String[] args
2. Java is case-sensitive... system.out.println() ... should be .. System.out.println().
3. Close the System.out.println() statement with a semicolon.. i.e. ;
4. I imagine you want to print the sum of a + b... so why not say ("a + b = " + c)
grin
I neva know anything about programs before cry
If it's to pieces computer I know but programming I no know cry
Re: I Want To Learn Programming. Which Language Should I Start With? by teewhydope(m): 8:23am On Jan 10, 2016
Respect to ChinenyeN cool cool grin

These are the type of people I.....

grin smiley

2 Likes

Re: I Want To Learn Programming. Which Language Should I Start With? by Ymodulus: 8:29pm On Jan 11, 2016
ChinenyeN:


Java and Python are simply tools, both of which you can use to do the same/similar things. The only true difference is how those things are done. Between the two, Python is easier to learn, but I would recommend Java. Java may be notoriously convoluted, but it teaches (or maybe, I should say enforces) some good programming habits, especially when it comes to OOP (object oriented programming). It's not to say that Python doesn't teach good programming habits. It's just that from my own personal opinion, the complicated nature of Java really exposes the OOP thought-process, which is something you'll need to understand if you plan on programming in either Java or Python, or any OOP language for that matter.

I would have gone haywire on you. But due to the fact you said they were your personal opinions. Also a language been complicated does not translate to been best. AS i said i would have gone haywire.



Am impressed with your work here sir. You code only JAVA ?
Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 10:56pm On Jan 11, 2016
Ymodulus, why would you have gone haywire? I don't believe Java is the best language. In fact, I don't believe any language is the best language. They're all just tools in my eyes... tools to be used in appropriate instances.

I actually just started learning Java early last month. I'm a novice.
Re: I Want To Learn Programming. Which Language Should I Start With? by Nobody: 8:41am On Jan 12, 2016
ChinenyeN:
Ymodulus, why would you have gone haywire? I don't believe Java is the best language. In fact, I don't believe any language is the best language. They're all just tools in my eyes... tools to be used in appropriate instances.

I actually just started learning Java early last month. I'm a novice.
How do you go about learning java please? Private, school or online courses? Please advice
Re: I Want To Learn Programming. Which Language Should I Start With? by ibietela2(m): 4:11pm On Jan 12, 2016
Still battling with my web development languages........ Who has beginner resources on JAVA?

Here is my focus HTML5, CSS3, PHP, MYSQL, Js/jQuery, Java or phyton

2 Likes

Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 5:26pm On Jan 12, 2016
MULLAH123:
How do you go about learning java please? Private, school or online courses? Please advice

I'm using online tutorials, specifically the one at http://www.tutorialspoint.com/java/java_tutorial.pdf
Re: I Want To Learn Programming. Which Language Should I Start With? by ibietela2(m): 5:53pm On Jan 12, 2016
ChinenyeN:


I'm using online tutorials, specifically the one at http://www.tutorialspoint.com/java/java_tutorial.pdf

Have you checked codecademy.com?

1 Like

Re: I Want To Learn Programming. Which Language Should I Start With? by ChinenyeN(m): 6:19pm On Jan 12, 2016
Ibietela2, I actually have a codecademy account, but I almost never log on to it. I guess I've always preferred tinkering with things on my own. But I just checked now and it looks like the Java Fundamentals course is only a 4-hour course (estimated). I guess I'll log in over the weekend and go straight through it, then go back to tinkering. Thanks for reminding me of that.
Re: I Want To Learn Programming. Which Language Should I Start With? by ibietela2(m): 7:07pm On Jan 12, 2016
ChinenyeN:
Ibietela2, I actually have a codecademy account, but I almost never log on to it. I guess I've always preferred tinkering with things on my own. But I just checked now and it looks like the Java Fundamentals course is only a 4-hour course (estimated). I guess I'll log in over the weekend and go straight through it, then go back to tinkering. Thanks for reminding me of that.

Ohk..... How did you see my choices
Re: I Want To Learn Programming. Which Language Should I Start With? by Mich43l(m): 11:26am On Jan 14, 2016
Thats probably the most popular question someone new to coding can ask. the only problem to that question is that you can ask 20 different programmers and get 20 different answers. there are thousands of options. the trick is to answer simple questions on your own such as:

*Which platform do i want to build on (are we talking web, mobile apps, desktop etc.)

*your strengths also matter(some programming languages are quite straightfoward with their syntax but do not really offer much complexity of what they can achieve).

*why are you interested in coding in the first place?

after these questions have been asked and answered it will help narrow your search down, then you can decide better.

learning programming online is a good way to go with many online schools such as https://www.udemy.com/, https://www.edx.org/, https://www.udacity.com/, http://www.simplilearn.com/ etc.

In nigeria you have companies such as [url]http://eti.ng/ [/url] that also offer great online courses.

So in summary, no one can answer the question better than you yourself
Re: I Want To Learn Programming. Which Language Should I Start With? by Doyin2016: 1:08pm On Jan 14, 2016
JOIN AUTOCLUB 4FREE!!! 2JOIN! Send ur name,email,phone no,vehicle make,model nd year,registration or VIN..to 08026866459.@autoclub..we do nd renew drivers license,vehicle particulars,we sell all types of vehicle spare parts nd deliver it @ur doorsteps
Re: I Want To Learn Programming. Which Language Should I Start With? by sanmy(m): 1:37am On Jan 16, 2016
Please I need person wey go fit teach me java... i've tried reading some books on it but can't really understand.. Due to my own nature, i'd need someone to put me through the basics then I can do the rest home work myself... for convinency sake, i'd prefer someone around ikeja,agege,ogba,berger nd it environ....<WhatsApp 08139410217
Re: I Want To Learn Programming. Which Language Should I Start With? by isidollarboy(m): 7:57pm On Jan 16, 2016
Goodday oga's in the house. I need una advice. I want to learn php and java language, how much and what will it cost me. I only have little knowledge in html. I will also be doing them in my course module by next year, i want to start preparing myself down... I need una contributions and advice...

(1) (2) (3) ... (51) (52) (53) (54) (55) (56) (57) ... (165) (Reply)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 66
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.