Post: C Language help please! :)
04-13-2011, 12:10 PM #1
Outlasted Wolf
Do a barrel roll!
(adsbygoogle = window.adsbygoogle || []).push({}); Hi,
I recently picked up programming and have been doing html, bat, bit of JavaScript.. and wanted to learn a "proper" language.Winky Winky
I'm starting to do C and am looking for some help too learn it.
So if somebody knows a book or tut.. Happy Please help me Smile
Oh, i've searched the forum and haven't found anything on C and if this already is a post could you redirect me Smile
Thanks
Last edited by Outlasted Wolf ; 04-13-2011 at 12:47 PM.
04-20-2011, 03:48 AM #20
Pichu
RIP PICHU.
Originally posted by xNCK View Post
And you're disabled, and you're supposed to be in a institution for mentally ill people.

This is fun!


You can also change it to say:

And you're disabled, and you're supposed to be in a institution for the mentally ill.

^ Sounds better that way.
04-20-2011, 04:05 AM #21
RedHair
Pokemon Trainer
Originally posted by ox3 View Post
And you're disabled, and your supposed to be in a institution for mental people.


nigga why you flaming him lol and did you finish those things :fa:
04-20-2011, 08:59 AM #22
vSaBoTeuR x
< ^ > < ^ >
Originally posted by RedHair View Post
nigga why you flaming him lol and did you finish those things :fa:


Nigga, this b to the itch started flamin' me, so I did bak and nao all de mods are cryin', nigga.
04-20-2011, 02:04 PM #23
Josh_ox3
Treasure hunter
Originally posted by RedHair View Post
nigga why you flaming him lol and did you finish those things :fa:


No, the other guy got told by some random guy, know his best comebacks are staring at my screen looking for spelling mistakes.
04-20-2011, 02:17 PM #24
    using namespace std;
#include<iostream>
#include<stdio.h>
#include<math.h>

int radius (int a)
{
float pi;
pi = M_PI;
a = pi * (a*a);
return a;
}
int main()
{
int a;
cout << "\t\vThe Area of The Circle\n\n\n";
cout << "This will also save as a file named Results\n";
cout << "\tWhat is the Radius?\n";
cin >> a;
cout << "The answer is: "<< radius(a) <<"\n";
return 0;
}



Originally posted by Outlasted
Well thaks a lot Smile and I'll take a look at VB.NET later then!
Oh and btw, this is how far ive got in C, its for calculating the area of a circle where you input the radius:


#include<stdio.h>
#include<math.h>

int main()
{
int a;
float pi;
pi = M_PI;
printf("\t\vThe Area of The Circle\n");
printf("\n");
printf("\n");
printf ("This will also save as a file named Results");
printf ("\n");
printf("\tWhat is the Radius?\n");
scanf("%d",&a);
a = pi * (a*a);
printf("The answer is %d",a);
printf("\n");
FILE *f;
f = fopen("Results.txt","w");
fprintf(f,"Test 01: %d\n",a);
return 0;
}


Is it well written? I've got 2 questions two plz Smile how do you make it print the real value (with something point etc) and when it saves it as a text file, each time i restart the programm it rewrites, so how could i make it continue in the same file?

The following user thanked MoBaTeY for this useful post:

Outlasted Wolf
04-20-2011, 03:45 PM #25
Outlasted Wolf
Do a barrel roll!
Originally posted by MoBaTeY View Post
    using namespace std;
#include<iostream>
#include<stdio.h>
#include<math.h>

int radius (int a)
{
float pi;
pi = M_PI;
a = pi * (a*a);
return a;
}
int main()
{
int a;
cout << "\t\vThe Area of The Circle\n\n\n";
cout << "This will also save as a file named Results\n";
cout << "\tWhat is the Radius?\n";
cin >> a;
cout << "The answer is: "<< radius(a) <<"\n";
return 0;
}


THanks for this Smile It looks very good but it says there a re lots of errors in main when i compile it with gcc (im on linux) :(

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo