Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,774 members, 7,809,987 topics. Date: Friday, 26 April 2024 at 06:23 PM

I Need Help On C - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / I Need Help On C (4294 Views)

Tutor On C# Needed / Help Needed On C# / I Need Training On C# And Java (2) (3) (4)

(1) (2) (3) (Reply) (Go Down)

I Need Help On C by babajeje123(m): 5:38pm On Jan 29, 2017
When I began self study on Java, someone encouraged me here to start with C. I went on with my Java and I'm enjoying the learning. However, I just started my Msc and C is among those languages we must know. I did C during my undergraduate days but can't remember a thing on it. I've downloaded "C How to Program" by Paul Deitel. Please, how do I get a compiler for C? Can I compile C on cmd like Java? If yes, how? If no, what should I do? Gracia!
Re: I Need Help On C by orimion(m): 7:01pm On Jan 29, 2017
babajeje123:
When I began self study on Java, someone encouraged me here to start with C. I wen on with my Java and I'm enjoying the learning. However, I just started my Msc and C is among those language we must know. I did C during my undergraduate days but can't remember a thing on it. I've downloaded "C How to Program" by Paul Deitel. Please, how do I get a compiler for C? Can I compile C on cmd like Java? If yes, how? If no, what should I do? Gracia!
Yes if on linux GCC is installed by default just $ cc [some flags] *infile* [some flags] *outfile* you then run with $ ./outfile . You could also look into clang . I'm not sure for other OS
Re: I Need Help On C by babajeje123(m): 9:38am On Jan 30, 2017
orimion:
Yes if on linux GCC is installed by default just $ cc [some flags] *infile* [some flags] *outfile* you then run with $ ./outfile . You could also look into clang . I'm not sure for other OS
I use Windows.
Re: I Need Help On C by asalimpo(m): 10:01am On Jan 30, 2017
google codeblocks
Re: I Need Help On C by Raypawer(m): 10:13am On Jan 30, 2017
dev c++, i use it for c and c++
Re: I Need Help On C by asalimpo(m): 11:19am On Jan 30, 2017
dev c++ is terrible. Unmaintained and very buggy. Stay away from it. Codeblocks is your friend. Or if you want,
use eclipse, netbeans as a front end to mingw. YIYF (youtube is your friend).

1 Like

Re: I Need Help On C by babajeje123(m): 11:55am On Jan 30, 2017
asalimpo:
dev c++ is terrible. Unmaintained and very buggy. Stay away from it. Codeblocks is your friend. Or if you want,
use eclipse, netbeans as a front end to mingw. YIYF (youtube is your friend).
Thank you. Do you mean I can use eclipse that I use for Java to run C too? and what do you mean by eclipse / netbeans as a front end to mingw?

1 Like

Re: I Need Help On C by asalimpo(m): 1:23pm On Jan 30, 2017
babajeje123:

Thank you. Do you mean I can use eclipse that I use for Java to run C too? and what do you mean by eclipse / netbeans as a front end to mingw?
Yes. You can install a c/c++ compiler then configure netbeans/eclipse to work with it.
it will highlight your code just like it would java code, but the source code will be sent to the c/c++ compiler in the "back" i.e the backend, just like is the case with the java compiler.
They're youtube vids on this. for compiler use mingw. Alternatively, you can just use codeblocks.
Stay away from devc++, is abandonware/rarely maintained and it crashes like crazy.
Re: I Need Help On C by babajeje123(m): 7:49pm On Jan 30, 2017
asalimpo:

Yes. You can install a c/c++ compiler then configure netbeans/eclipse to work with it.
it will highlight your code just like it would java code, but the source code will be sent to the c/c++ compiler in the "back" i.e the backend, just like is the case with the java compiler.
They're youtube vids on this. for compiler use mingw. Alternatively, you can just use codeblocks.
Stay away from devc++, is abandonware/rarely maintained and it crashes like crazy.
Thank you bro. I downloaded codeblocks and it has been giving me a hell since morning. each time I compiled the program, I get this message "addition.exe has stopped working". My program gets terminated afterwards. devc++ is giving me the same problem. trust me, I have combed throughout the net without any solution. What do you think I should do?
Re: I Need Help On C by asalimpo(m): 8:47pm On Jan 30, 2017
babajeje123:

Thank you bro. I downloaded codeblocks and it has been giving me a hell since morning. each time I compiled the program, I get this message "addition.exe has stopped working". My program gets terminated afterwards. devc++ is giving me the same problem. trust me, I have combed throughout the net without any solution. What do you think I should do?
I'm not into cpp/c for now. Though i did some of it last year.
Find a cpp/c person to help you out.
in the meanwhile, do incremental debugging. write the barest minimum code that should compile without a hitch, then add the rest of the codes, one statement at a time only if the last compilation succeeded.
On the other hand, it maybe that there's no logic error but that the program is hugging resources, causing the system to hang (windows) hence prompting that error message you see.
Do the incremental compiling to find where the bug is.
Re: I Need Help On C by stack1(m): 3:47am On Jan 31, 2017
babajeje123:

Thank you bro. I downloaded codeblocks and it has been giving me a hell since morning. each time I compiled the program, I get this message "addition.exe has stopped working". My program gets terminated afterwards. devc++ is giving me the same problem. trust me, I have combed throughout the net without any solution. What do you think I should do?

There's some error in your code, causing the runtime exception (i.e making your program close), Why not post the source-code
Re: I Need Help On C by Nobody: 12:33pm On Jan 31, 2017
configure the compiler accurately . check YouTube will will see how to configure it live and direct , there is nothing wrong with ur code.
Re: I Need Help On C by Raypawer(m): 1:50pm On Jan 31, 2017
could you post your code? i think the problem could also come from the code..

babajeje123:

Thank you bro. I downloaded codeblocks and it has been giving me a hell since morning. each time I compiled the program, I get this message "addition.exe has stopped working". My program gets terminated afterwards. devc++ is giving me the same problem. trust me, I have combed throughout the net without any solution. What do you think I should do?
Re: I Need Help On C by babajeje123(m): 5:42pm On Jan 31, 2017
Raypawer:
could you post your code? i think the problem could also come from the code..


#include<stdio.h>
int main()
{

int num1;
int num2;
int sum;

printf("Enter the first number: "wink;
scanf("%d", num1);

printf("Enter the second number: "wink;
scanf("%d, num2"wink;

sum = num1 + num2;

printf("Sum is %d", sum);

return 0;

}

I really don't think there's any issue with the code. I guess it has to do with settings. Please, help me.
Re: I Need Help On C by babajeje123(m): 5:42pm On Jan 31, 2017
stack1:


There's some error in your code, causing the runtime exception (i.e making your program close), Why not post the source-code
#include<stdio.h>
int main()
{

int num1;
int num2;
int sum;

printf("Enter the first number: "wink;
scanf("%d", num1);

printf("Enter the second number: "wink;
scanf("%d, num2"wink;

sum = num1 + num2;

printf("Sum is %d", sum);

return 0;

}

I really don't think there's any issue with the code. I guess it has to do with settings. Please, help me.
Re: I Need Help On C by femarse: 5:52pm On Jan 31, 2017
pls help me on how to configure wampserver for PHP window 64bit 8.1 I already downloaded and installed wampserver (Apache , MySQL, ) PHP
Re: I Need Help On C by stack1(m): 5:58pm On Jan 31, 2017
babajeje123:

#include<stdio.h>
int main()
{

int num1;
int num2;
int sum;

printf("Enter the first number: "wink;
scanf("%d", num1);

printf("Enter the second number: "wink;
scanf("%d, num2"wink;

sum = num1 + num2;

printf("Sum is %d", sum);

return 0;

}

I really don't think there's any issue with the code. I guess it has to do with settings. Please, help me.

Yup there is, the scanf statements

scanf takes the memory address of variables it is to store into


change the lines
scanf("%d", num1); to scanf("%d", &num1); //The ampersand character (& ) signifies we are
// using an address as the argument, in this case the address of the variable num1
scanf("%d", num2); to scanf("%d", &num1);

Re: I Need Help On C by bet9ja(m): 6:31pm On Jan 31, 2017
babajeje123:
When I began self study on Java, someone encouraged me here to start with C. I wen on with my Java and I'm enjoying the learning. However, I just started my Msc and C is among those language we must know. I did C during my undergraduate days but can't remember a thing on it. I've downloaded "C How to Program" by Paul Deitel. Please, how do I get a compiler for C? Can I compile C on cmd like Java? If yes, how? If no, what should I do? Gracia!



You did C but can't remember a thing, this is not sounding good.

1 Like

Re: I Need Help On C by babajeje123(m): 7:03pm On Jan 31, 2017
bet9ja:




You did C but can't remember a thing, this is not sounding good.
And your business with that undecided?
Re: I Need Help On C by babajeje123(m): 7:13pm On Jan 31, 2017
stack1:


Yup there is, the scanf statements

scanf takes the memory address of variables it is to store into


change the lines
scanf("%d", num1); to scanf("%d", &num1); //The ampersand character (& ) signifies we are
// using an address as the argument, in this case the address of the variable num1
scanf("%d", num2); to scanf("%d", &num1);

Thanks. It is the same thing after the correction. The program is compiling but not running. This is the new code:
#include<stdio.h>

int main()
{

int num1;
int num2;
int sum;

printf("Enter the first number: "wink;
scanf("%d", &num1);

printf("Enter the second number: "wink;
scanf("%d", &num2);

sum = num1 + num2;

printf("Sum is %d", sum);

return 0;

}
Re: I Need Help On C by stack1(m): 7:37pm On Jan 31, 2017
femarse:
pls help me on how to configure wampserver for PHP
window 64bit 8.1
I already downloaded and installed
wampserver (Apache , MySQL, )
PHP

Where are you getting stuck at
Re: I Need Help On C by stack1(m): 7:40pm On Jan 31, 2017
babajeje123:

Thanks. It is the same thing after the correction. The program is compiling but not running. This is the new code:
#include<stdio.h>

int main()
{

int num1;
int num2;
int sum;

printf("Enter the first number: "wink;
scanf("%d", &num1);

printf("Enter the second number: "wink;
scanf("%d", &num2);

sum = num1 + num2;

printf("Sum is %d", sum);

return 0;

}

You say you are using Codeblocks, i suggest uninstalling and re-installing code-blocks and the compilers it came with I'm guessing its not compiling/ linking properly that's why its giving such errors
Re: I Need Help On C by femarse: 8:42pm On Jan 31, 2017
stack1:


Where are you getting stuck at

first I got the error wampserver could not start due to vcruntime140.dll is missing

then I abandon it and use netbeans , when I run. the code Internet explorer open but come with the error server is missing or something
Re: I Need Help On C by Damzed(f): 9:15pm On Jan 31, 2017
Hmmm,I guess you are doing ur msc in unilag,if so join the whatsapp group for more info on your topic
Re: I Need Help On C by asalimpo(m): 11:23pm On Jan 31, 2017

#include<stdio.h>
int main()
{

int num1;
int num2;
int sum;

printf("Enter the first number: "wink ;
//scanf("%d", num1);

//printf("Enter the second number: " ) ;
//scanf("%d, num2"wink;

//sum = num1 + num2;

//printf("Sum is %d", sum);

return 0;

}

try that first, to see if it compiles and works. Click the executable to see if it runs normally.
if it runs, give a report , for the next step
// means comments.
Re: I Need Help On C by ChinenyeN(m): 12:04am On Feb 01, 2017
EDIT: I just returned home and decided to write and compile your code on my own machine. I was mistaking before. It is not what I believed it may have been. In fact, the code compiles and runs just fine on my machine. Perhaps this may be an issue with the IDE you are using and how it is configured. If so, then I'm afraid I might not be of much assistance there, since I don't actively use IDEs. Also, I should probably state that I compiled your code from the command line on my own machine.

What are the specific error messages (if any) that you get when you try to compile and run your program, babajeje123? Most likely, following stack1's suggestion of uninstalling and reinstalling the IDE might help.
Re: I Need Help On C by babajeje123(m): 5:30am On Feb 01, 2017
stack1:


You say you are using Codeblocks, i suggest uninstalling and re-installing code-blocks and the compilers it came with I'm guessing its not compiling/ linking properly that's why its giving such errors

Thank you so much stack1. The program is compiling and running now. What happened was that I was using the codeblocks with its default settings. I didn't select the option which would make it run C after installation. Thanks, once again.
Re: I Need Help On C by babajeje123(m): 5:31am On Feb 01, 2017
asalimpo:

#include<stdio.h>
int main()
{

int num1;
int num2;
int sum;

printf("Enter the first number: "wink ;
//scanf("%d", num1);

//printf("Enter the second number: " ) ;
//scanf("%d, num2"wink;

//sum = num1 + num2;

//printf("Sum is %d", sum);

return 0;

}

try that first, to see if it compiles and works. Click the executable to see if it runs normally.
if it runs, give a report , for the next step
// means comments.
Thanks. The program is running now.
Re: I Need Help On C by babajeje123(m): 5:32am On Feb 01, 2017
ChinenyeN:
EDIT: I just returned home and decided to write and compile your code on my own machine. I was mistaking before. It is not what I believed it may have been. In fact, the code compiles and runs just fine on my machine. Perhaps this may be an issue with the IDE you are using and how it is configured. If so, then I'm afraid I might not be of much assistance there, since I don't actively use IDEs. Also, I should probably state that I compiled your code from the command line on my own machine.

What are the specific error messages (if any) that you get when you try to compile and run your program, babajeje123? Most likely, following stack1's suggestion of uninstalling and reinstalling the IDE might help.
Program is running now. Thanks
Re: I Need Help On C by babajeje123(m): 6:14pm On Mar 02, 2017
@ChinenyeN,@asalimpo, @stack1 & @others, I need your help on this question please.
"Consider an input file (attached file). Each subject has 3 units. You are required to write a program that generates grade points and store the result in a file called StudGpa.csv. Appropriate comment must be used in each segment of the program".

I need someone to please guide me in solving this question.

Re: I Need Help On C by 2mNaira: 8:57pm On Mar 02, 2017
There are three important skills you need to be a good programmer: ability to study, ability to do research and ability to think hard.

I hope you are not indirectly asking people here to help you with your assignment because towing that line will make you need someone to help you with your c programming tasks when you go for your PHD.

The first thing you should do is to think and try to solve the problem by yourself, then when you get stuck, you should come here and ask for assistance.

The sure way to get a good grasp of any language is to get materials on them and study them.

Get U-tube videos, e-books, or visit tutorial sites. A simple google search with inundate you with relevant results. These is what you should do first. Posting the question here without previous personal effort will not help you and anyone who attempts to solve the problem for you without any previous effort from you is not helping you.

First, attempt to solve the program by writing your answer to the console. Afterwords you should write a reworked version that writes to file.

The fact that you were asked to save your output in a csv show that you are expected to write other data with the GPA value like student name and registration number. So you should read up on csv file.

So in summary this is my guidance:

1. Sit down an attempt to solve the problem first without writing output to file. You will need to consult one or more materials in other to do so.
2. Re-write the relevant code segment with output written to file. You may also need to consult one or more materials so as to learn how file i/o is handled in C. You also need to read up on csv file format so as to know the proper way to format your output.

Google for and download the e-book "C: The complete Reference by Herbert Scheildt".

I wish you the best of luck.

Modified:

I had another look your question. I even when further to look at your output file. It appears to me that you are only expected to generate the grade points using the input data from the input file and not really the GPA.

So you can start out by first writing the input data in multi-dimensional arrays or properly organised non-multidimensional arrays. Use that array values as you program input, then when you are satisfied with your program you can then proceed to reading input from the file.

Since reading input from file is also an i/o operation. It still emphasizes your need to read up on file i/o.

Finally, you need to read up on how to read data from excel file into a c++ program. You will get more than enough result from google search on that.

That's all from me.

1 Like

Re: I Need Help On C by babajeje123(m): 9:58pm On Mar 02, 2017
mnairaland:
There are three important skills you need to be a good programmer: ability to study, ability to do research and ability to think hard.

I hope you are not indirectly asking people here to help you with your assignment because towing that line will make you need someone to help you with your c programming tasks when you go for your PHD.

The first thing you should do is to think and try to solve the problem by yourself, then when you get stuck, you should come here and ask for assistance.

The sure way to get a good grasp of any language is to get materials on them and study them.

Get U-tube videos, e-books, or visit tutorial sites. A simple google search with inundate you with relevant results. These is what you should do first. Posting the question here without previous personal effort will not help you and anyone who attempts to solve the problem for you without any previous effort from you is not helping you.

First, attempt to solve the program by writing your answer to the console. Afterwords you should write a reworked version that writes to file.

The fact that you were asked to save your output in a csv show that you are expected to write other data with the GPA value like student name and registration number. So you should read up on csv file.

So in summary this is my guidance:

1. Sit down an attempt to solve the problem first without writing output to file. You will need to consult one or more materials in other to do so.
2. Re-write the relevant code segment with output written to file. You may also need to consult one or more materials so as to learn how file i/o is handled in C. You also need to read up on csv file format so as to know the proper way to format your output.

Google for and download the e-book "C: The complete Reference by Herbert Scheildt".

I wish you the best of luck.

Modified:

I had another look your question. I even when further to look at your output file. It appears to me that you are only expected to generate the grade points using the input data from the input file and not really the GPA.

So you can start out by first writing the input data in multi-dimensional arrays or properly organised non-multidimensional arrays. Use that array values as you program input, then when you are satisfied with your program you can then proceed to reading input from the file.

Since reading input from file is also an i/o operation. It still emphasizes your need to read up on file i/o.

Finally, you need to read up on how to read data from excel file into a c++ program. You will get more than enough result from google search on that.

That's all from me.
Thanks so much for your response. I wasn't actually looking for someone who will proffer solution but someone who would guide me in solving the question. And that's what you have done. God bless.

1 Like

(1) (2) (3) (Reply)

React + Node Js : Fullstack Web Development Training / Minimum Computer Specs For Programming / Loki v 1.8 http Bot | Best Botnet 2017| Programming Tutorial |all Browser

(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. 75
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.