Forum: C Dec 16th, 2008 |
| Replies: 1 Views: 358 when i try to do the following,
double root_value, c;
int d;
d=0;
printf("%.0f", root_value);
for(c=2; c<root_value;c++)
{ |
Forum: C Dec 16th, 2008 |
| Replies: 4 Views: 883 well basically im writing to file with this
while(fgets(prime, 2000, fin)!=NULL) {
root_value = atof(prime);
fprintf(fout, "%.0f\t", root_value);
}
now i... |
Forum: C Dec 16th, 2008 |
| Replies: 4 Views: 883 im trying to right align data that i have written to file with fprintf, but im not sure how i would do so in C. ive looked around and there are many solutions for C++ and C# but havent found one for... |
Forum: C Feb 13th, 2007 |
| Replies: 26 Views: 4,468 but when i leave it as (filename,'w') and compile and run, the program notes a windows error and closes, and no file is generated |
Forum: C Feb 13th, 2007 |
| Replies: 26 Views: 4,468 but i though the entry in fopen has to be a either in "" or predefined?
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define INFILE "questions.txt"
int main(int argc, char... |
Forum: C Feb 13th, 2007 |
| Replies: 26 Views: 4,468 well i used
fout = fopen("%s.txt", "w");
but how do i represet "%s.txt" as the user's input? |
Forum: C Feb 13th, 2007 |
| Replies: 26 Views: 4,468 well all i want to do is for the user to input a name or number and for the program to create a text file with that name. im not actually writing anything into the file, its just an empty .txt file... |
Forum: C Feb 13th, 2007 |
| Replies: 26 Views: 4,468 well the entirety is only
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(int argc, char *argv[]) {
char line[255];
fgets(line, 255, stdin);
char filename[80];... |
Forum: C Feb 13th, 2007 |
| Replies: 26 Views: 4,468 the program runs, but no output file is generated? am i missing a command still?
char line[255];
fgets(line, 255, stdin);
char filename[80];
sprintf(filename,"%s.txt",line); |
Forum: C Feb 12th, 2007 |
| Replies: 26 Views: 4,468 how to turn a user input into a text file for example user inputs 100 and the program creates a text file named 100.txt?
I have tried to work it out but it still doesnt work properly.
i used
... |
Forum: C Feb 10th, 2007 |
| Replies: 3 Views: 855 how do i make sure the student id becomes the output file name, and that the entered answers are printed into that specific file |
Forum: C Feb 10th, 2007 |
| Replies: 3 Views: 855 im making a program that:
-asks a user for their studentID and stores it as a string.
-opens questions.txt for reading
-prints to screen the question followed by each answer on a seperate line... |
Forum: C Feb 10th, 2007 |
| Replies: 1 Views: 1,108 writing part of a program where user inputs an ID and the program generates a .txt file with the ID name(numerical ID).
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define INFILE... |
Forum: C Feb 3rd, 2007 |
| Replies: 5 Views: 4,485 hi im still finishing a calculator program. the problem is i am wondering what command to use to break out of multiple loops. my code is
#include <stdio.h>
#include <ctype.h>
#include <math.h>... |
Forum: C Feb 3rd, 2007 |
| Replies: 10 Views: 4,326 Any idea on how to add an integer only mode? where it disregards any numbers after decimal |
Forum: C Feb 2nd, 2007 |
| Replies: 10 Views: 4,326 thanks! that helped out a lot |
Forum: C Feb 2nd, 2007 |
| Replies: 10 Views: 4,326 also, in pellesC i keep getting a POLINK: fatal error: Access is denied.
message, but if i put the same code in Dev-C++ it doesnt show up(im programming Dev-C++ in C as well) |
Forum: C Feb 2nd, 2007 |
| Replies: 10 Views: 4,326 Well the updated code is now
#include <stdio.h>
#include <ctype.h>
#include <math.h>
float do0p(char op, float acc, float num) {
switch (op) {
case '+' : return acc + num;
... |
Forum: C Feb 2nd, 2007 |
| Replies: 10 Views: 4,326 hm i changed the code and it complies now, but when i try to inter a number, an error appears |
Forum: C Feb 2nd, 2007 |
| Replies: 10 Views: 4,326 im writing a calculator program in c and having some trouble..
basically it needs to have + - / * ^ functions as well as an integer only mode
the code so far
#include <stdio.h>
#include... |
Forum: C Jan 26th, 2007 |
| Replies: 12 Views: 2,344 nvm that doesnt work either |
Forum: C Jan 26th, 2007 |
| Replies: 12 Views: 2,344 if i change getch() to getc(fin) it returns p-other wise the errors appear |
Forum: C Jan 26th, 2007 |
| Replies: 12 Views: 2,344 which means theres no getch() |
Forum: C Jan 26th, 2007 |
| Replies: 12 Views: 2,344 lol im using pellesC thats why |
Forum: C Jan 26th, 2007 |
| Replies: 12 Views: 2,344 hmm looks that way but errors still come up:
D:\Program Files\PellesC\Projects\assignment2\main.c(37): error #1053: Disagreement in number of macro arguments.
D:\Program... |
Forum: C Jan 26th, 2007 |
| Replies: 12 Views: 2,344 it helps..but the problem is with this it only prints 1 charc... |
Forum: C Jan 26th, 2007 |
| Replies: 12 Views: 2,344 im writing a program that opens a file, reads until it arrives at a colon, then jumps over the colon and reads the number after the colon
the txt file contains
pi:3.14159
feetPerMile:5280... |