LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-05-2017, 01:34 AM   #16
adolphina
LQ Newbie
 
Registered: Feb 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by astrogeek View Post
In addition to what pan64 has said, your if ( a==0 ) test also appears to be incorrect.

As you have never answered the question as to whether you intend to use C or C++, we will assume C++ based on your example code.

I would suggest that you should work through some online tutorials to learn your way around the language before trying to write and debug your own examples.

There is a sticky post at top of the Programming forum for C/C++ Tutorials, use it! And this page has a really good set of basic tutorials for both C and C++, just start at top of the list and work your way down!

Put some effort into understanding how it all works, not just in making it work.

And learn to use the man pages for common language constructs such as conditionals, loops and basic I/O, and library functions like strtol, scanf, etc. You have the documentation for the language and standard libraries built-in to most GNU/Linux distributions - learn to understand it and use it.

And try to understand and use the advice and examples already given by others. We are happy to help, but you must actually learn from the help provided.
I totally agree with u, i would try to lern by my own before coding something new, thanks.
 
Old 03-05-2017, 08:06 AM   #17
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,658

Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by adolphina View Post
hello. I am new to C language.
i ve got two questions:
1) how can i check that user entered the number (float or int but not) some letters?
for example:
Code:
error1:
cout << "Enter a" << endl;
cin >> a ;
if a is float or int
/do something/
if a is a string
/it is an error. Goto error1;/
and the second question:
2) how i may close a C program runnig in terminal (The OS is linux mint)?
thank You for yor answers!


I have the feeling that you maybe are trying too fast the next level.
maybe this very basic program for beginners might be helping you: https://raw.githubusercontent.com/sp...le-x86-bin.png

I would recommend to start with simple codes, such as hello world, and look at this good book: https://archive.org/details/TheCProg...geFirstEdition

for your float, it is not that easy to start. You may work with a loop for controlling each chars, if you convert it before to a char.

Last edited by Xeratul; 03-05-2017 at 08:07 AM.
 
Old 03-06-2017, 06:41 PM   #18
NoStressHQ
Member
 
Registered: Apr 2010
Location: Geneva - Switzerland ( Bordeaux - France / Montreal - QC - Canada)
Distribution: Slackware 14.2 - 32/64bit
Posts: 609

Rep: Reputation: 221Reputation: 221Reputation: 221
Quote:
Originally Posted by Xeratul View Post
I have the feeling that you maybe are trying too fast the next level.
Funny because I'd say the same about ncateditor ... Well this might be bigger than you think, and seeing the code, you might not be ready for a huge project like that neither .

But sorry, I don't want to "kill" your motivation, it's good to try and you'll learn a lot of things, I say that because you might have problem recruiting "contributors" the way it is...

(BTW: I can understand the nostalgia about turboc, I've also started with borland tools, and I cherrish them in my memory ).

Bests.

Garry.
 
2 members found this post helpful.
  


Reply

Tags
linux, programing



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
close a program remotely jokar.mohsen Linux - Networking 3 02-12-2014 05:29 AM
Can't close a program.. why? how? brynjarh Linux - Newbie 7 08-12-2004 01:12 AM
how do i close a program lol Longinus Linux - Newbie 5 02-15-2004 12:10 AM
Gtk-Warning but program still works... I close konsole, program closes Laptop2250 Linux - Software 2 11-14-2003 11:18 PM
Kalculator program how to close screen Laptop2250 Programming 4 10-27-2003 04:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration