zeroliken 79 Nearly a Posting Virtuoso

help you in what?

is there a specific error you want to tell?
are you asking us for suggestions or instructions?
Are you unsure of what to do next?
or maybe the code doesn't give the correct output?

please specify

zeroliken 79 Nearly a Posting Virtuoso

I need to print out the scores and the grades when entered and i do not know how to print the scanner. im sure i am probably missing other things as well.

print the scanner?? or print the variables you used scanner at?? please make it more clear

also

System.out.printf("%s%d%s\n", "There are ",count, " student(s) in the class");
System.out.printf("%s%d%s\n", "The total of their scores = ",total,"points");

I'm not sure if this is the right way of doing this... I think it's more like this.

System.out.println("There are " + count + " student(s) in the class");
System.out.println("The total of their scores = " + total + "points");
zeroliken 79 Nearly a Posting Virtuoso

Since your using a 512 digit number my suggestion would be to convert it to hexadecimal base or a higher base digit, do the operation then convert it back to string or decimal base

though I'm not sure if this is the best solution

...Maybe using a long int might help you more in storing the numbers

zeroliken 79 Nearly a Posting Virtuoso

If you want to print out the exact number of decimal places then manipulate a decimal number between %f

printf ("%.1f",a); //will print out a with 1 decimal digit
zeroliken 79 Nearly a Posting Virtuoso

atoi1[0] = rev1[len1];
atoi2[0] = rev2[len2];
atoi1[1] = '\0';
atoi2[1] = '\0';
num1 = atoi(atoi1);
num2 = atoi(atoi2);

what are you trying to achieve here?
atoi just converts a string to an integer why put a null terminator at the end?

int i;
  char Input [512];
  printf ("Enter a number: ");
  fgets ( Input, 512, stdin ); // or use a standard scanf
  i = atoi (Input);
  printf ("The value entered is %d",i);
zeroliken 79 Nearly a Posting Virtuoso

Well your program does read brackets but it doesn't always output the right answer now does it?

You use a lot of unnecessary expressions in solving an equation
It's hard to narrow down which part of your code makes the problem

use comments on your codes for us to check properly what your doing

zeroliken 79 Nearly a Posting Virtuoso

I figured it out by now..

Good for you :)

@hiddepolen...
Thank you for the explanation

zeroliken 79 Nearly a Posting Virtuoso

Why use c in a loop condition.. why not use it as a counter?

Your not thinking from what I just said, the answer is already in front of you

zeroliken 79 Nearly a Posting Virtuoso

for(int c=1; c<=b; c++){
if(b ==5)
println("loop terminated " + c);
}

Why use c in a loop condition.. why not use it as a counter?

*"I'm not gonna explicitly say the answer to your problem"

zeroliken 79 Nearly a Posting Virtuoso

But why does b start at 30000 and something? Shouldn't b increment by 1?

What I meant to say was your using b as an increment while your using c in your initialization and your loop condition in your previous post

zeroliken 79 Nearly a Posting Virtuoso

for( c=0; c <= b; b++){
println("b = " + b);

Since nothing happens to c it will never be equal to b which is why it loops forever

if(b ==5){
println("loop terminated " + c++);
}

Also since b = 6 it will never be equal to 5

zeroliken 79 Nearly a Posting Virtuoso

What's this?.. another guess what's wrong with my code game... huh

Not only do you want us to do the work for you, but you did not state how your program works, it's purpose or the desired output.

zeroliken 79 Nearly a Posting Virtuoso

Isn't declaring a string in c already a null terminated character array?

zeroliken 79 Nearly a Posting Virtuoso

your going to use 2 dimensional arrays

Don't expect someone here to give you the immediate answer
try coding your work and we'll help you if you have any problems

zeroliken 79 Nearly a Posting Virtuoso

oh , i only got codeblocks don't know if it is good , since it didn't point much errors for me

On another note, how long have you been studying programming? i have only been studying for a month..

2 years.... most of the errors I pointed out are basic errors which can be fixed just by looking at your code

The compiler is not as important as the programmer

zeroliken 79 Nearly a Posting Virtuoso

I wrote it as a possible example on how to tokenize a sentence and view it in reverse where he might get a hint on how to do it by himself

sigh, looks like the intention shadowed the purpose :(

Sorry about that...I'll be more conscious next time around

zeroliken 79 Nearly a Posting Virtuoso

oo which compiler do you use?o.o

linux gcc

zeroliken 79 Nearly a Posting Virtuoso

Yes its possible to have a case within a case.

Did you compile your work cause I can see a lot of syntax error

scanf("%c", &option);

In lines 11,50,84,124,157,190,231,298,342,383
Use %s in receiving input

printf("Do you want to find the volume or surface area of the sphere?Indicate by entering the Initial Letter of the word\n");
scanf("%f", &option);

In line 268:
option is not a float

printf("\nThe surface area of the sphere is %.2f");

In line 285:
you forgot to put &surface_area

zeroliken 79 Nearly a Posting Virtuoso

printf("%d = %d\n",j,freq[i-2]);

why are you using you using freq[35998]?
I think that integer i your using is supposed to be j.

zeroliken 79 Nearly a Posting Virtuoso

you can use edit or delete operations on either the .bin file or .txt file as these only depend on your code

Since your teacher told you to use a binary file then your free to use a .bin file if it's a requirement

It doesn't really matter which you use to make your program work

the only difference is when you try to open, you can't read a binary file while your free to see your output in a text file

zeroliken 79 Nearly a Posting Virtuoso

int mark 1, mark 2, mark 3, mark 4, mark 5, The best 2 highest marks;

space is not used in variable name declaration

The best 2 highest marks = mark > 50 + mark > 50

This is not how you use an operation statement

if ( mark > 50 ){
printf (" mark > 50 ");
else {
printf (" the mark is not one of the best 2 highest marks ");
}

mark is not initialized

Did you compile your work cause you can see most of your errors there

zeroliken 79 Nearly a Posting Virtuoso

well yes, I know that. I was rather looking for someone to give me an example of how I could do this.

You're asking for something thats very basic in Java

zeroliken 79 Nearly a Posting Virtuoso

Here's my example

String Str = "The cake is a lie"; 
char delimiter =  ' '; //the space is the delimeter

// calculate the number of delimiter characters
int N = 0;
for (int i = 0; i < Str.length(); i++)
     if (Str.charAt(i) == delimiter) N++;

String[] tokens = new String[N+1];  //we add 1 for the last word
int[] tokenlength = new int[N+1];

// parse N+1 tokens and store in an array
int a = 0, b = 0;
for (int i = 0; i < N; i++) {
while(Str.charAt(a) != delimiter)
a++;
tokens[i] = Str.substring(b, a);    //saves the word in the array
tokenlength[i] = tokens[i].length();    //saves the length of the current word
a++;
b = a;
}
//For the last word
tokens[N] = Str.substring(a, Str.length());
tokenlength[N] = tokens[N].length();

// print results for testing
System.out.println(Str);
for (int i = 0; i < tokens.length; i++){
// print each tokens in reverse
for(int j = tokenlength[i]-1; j >= 0; j-- ){
System.out.print(tokens[i].charAt(j));  
}
System.out.print(" ");
} 

Also next time wrap your code in code tags

zeroliken 79 Nearly a Posting Virtuoso

tokenize the sentence by using space as a delimiter, save each letter in an array then print out the result in reverse

zeroliken 79 Nearly a Posting Virtuoso

Heres a more relevant example to your structure

struct emp{             //example structure
     char name[20];
  };

 void add(struct emp *employee,int n){
    int i;

        for(i=1;i<=n;i++){
          printf("Enter employee %i",i);	//my example on receiving input
          printf("\nEnter name:");
          scanf("%s",employee[i].name); 
        }
   }
 
  main()
  {
   int num = 5;			//defined number of employees
   struct emp employee[1000];	
   add(employee, num);         
  }
zeroliken 79 Nearly a Posting Virtuoso

We're supposed to have an array that stores every employee that is created, but i dont know how to create/'name' new employee's on the fly.

Does scanf on each index on the array doesn't solve your problem?

So my real question I guess is how do i set up my function call and definition?

Since I don't know what your structure looks like I'll make this example

struct x
   {
      int a;
      int b;
   };

   main()
   {
      struct x z;
	
      z.a = 5;

      printf("The first member is %d \n", z.a);   
   }

could you post your code for more details?

zeroliken 79 Nearly a Posting Virtuoso

Do not ask for code. We are not a coding service. We will help you fix your code.

If anyone posts a complete working solution for you, they are enabling cheaters.
If you use that code you are a cheater.

Read me

zeroliken 79 Nearly a Posting Virtuoso

You could store the number in an array then check each index for the English word

you can use an if else condition for every number from zero to nine in comparing

zeroliken 79 Nearly a Posting Virtuoso

I change my mind stultuske's method is more efficient

zeroliken 79 Nearly a Posting Virtuoso

You could store the numbers in an array of integers then compare them to know which is the highest number

zeroliken 79 Nearly a Posting Virtuoso

Could you post which part of your code you're having a problem with

Also wrap your codes in in code-tags

zeroliken 79 Nearly a Posting Virtuoso

You should have used your previous thread for clarifications dsoto

zeroliken 79 Nearly a Posting Virtuoso

how? .. can you at least help me with the logic ?

If you're compiling in C99, you could #include <stdbool.h> and use bool, true and false. bool would be a macro for _Bool, which itself is a standard type guaranteed to hold 0 or 1, and true and false are macros for 1 and 0 respectively.

If not, you could just use 0 and 1 directly.But anyway you already got the idea

zeroliken 79 Nearly a Posting Virtuoso

Why not use scanf like this?

printf("Enter two words: ");
scanf("%s",x1);
scanf("%s",x2);

Also why use a while condition when an if else condition can be enough

for(i = 0; i < c; i++)
{
    if (x1[i] == x2[i]){
        x3[i] = x1[i];
}
else break;
}
printf("%s\n",x3);
zeroliken 79 Nearly a Posting Virtuoso

you can use a boolean to know if the number has been repeated instead of using printf

zeroliken 79 Nearly a Posting Virtuoso

You could store the input numbers in an array and use a loop again to check if the current number has been entered before

zeroliken 79 Nearly a Posting Virtuoso

I completely agree that the boot time windows gets for every version gets worst I just hope that it becomes better for windows 8 regardless of the hardware

zeroliken 79 Nearly a Posting Virtuoso

Is it wrong to laugh while reading this? :D

Anyway the kid does have a point and maybe he'll earn some extra bucks from the right people

zeroliken 79 Nearly a Posting Virtuoso

Well basically you can't and only a mod can do something about it if they want

zeroliken 79 Nearly a Posting Virtuoso

Here is the detail of theCompiler's program

He's having a problem with the coding so maybe you can help him out by suggesting an approach or an algorithm to his problem

A bug is placed on a given square in the middle of a tile floor in a rectangular room of size n x m tiles. The bug wanders randomly from tile to tile throughout the room. Assuming that he may move from his present tile to any of the eight tiles surrounding him (unless he is against a wall) with equal probability, how long will it take him to touch every tile on the floor at least once?


An array N X M is used to represent the number of times bug has reached each tile on the floor. All the cells of this array are initialized to zero. The position of the bug on the floor is represented by the coordinates (IBUG,JBUG)The 8 possible moves of the bug are represented by the tiles located at (IBUG + IMVE(K), JBUG + JMVE(K)) where 1<= K<= 8 and:


IMVE(1) = -1 JMVE(1) = 1

IMVE(2) = 0 JMVE(2) = 1

IMVE(3) = 1 JMVE(3) = 1

IMVE(4) = 1 JMVE(4) = 0

IMVE(5) = 1 JMVE(5) = -1

IMVE(6) = 0 JMVE(6) = -1

IMVE(7) = -1 JMVE(7) = -1

IMVE(8) = -1 JMVE(8) = 0
A random walk to one of the 8 given squares is simulated by generating a random value …

zeroliken 79 Nearly a Posting Virtuoso

You could search the forum and learn from others like this

zeroliken 79 Nearly a Posting Virtuoso

Correct me if I'm wrong but shouldn't you use fscanf or fgetc since he needs to read a file?

myk45 commented: Thanks! +6
zeroliken 79 Nearly a Posting Virtuoso

It would be better if you explain more elaborately the desired output of your code

zeroliken 79 Nearly a Posting Virtuoso

He thanked you for helping him out.. I think he got it now

Also Engineer61 is requesting to delete the post containing his codes could I do this or maybe request an admin to do it?

zeroliken 79 Nearly a Posting Virtuoso

I am working on a project in c programming and relearning how to use malloc()

zeroliken 79 Nearly a Posting Virtuoso

If you look at the spam problem from a continental perspective, however, things do improve somewhat for the USA as North America drops to third place behind Asia and Europe. Indeed, North America and Europe together only contribute 35.6 percent of the world's spam content whereas Asia can be thoroughly ashamed of the 50.1 percent it throws around.

Somehow I'm not shocked at these results

zeroliken 79 Nearly a Posting Virtuoso

Here is engineer61's message to me regarding the details of the problem

I already asked him to post the code here but we might be having communication issues since most of the text is in turkish(by google translator)

Try to bear with it and maybe you can help him... cause I can't

firstly thank you for your interest.

Let me tell like this better:
a logic circuit connected to a file that lists gerçeklenmesi.Önce devre.txt olusturduk.Bu a given circuit, the entries in the file, such as types of doors and use the list of events will take place depending on the actual values ​​tutuldu.Sonra komut.txt writing to a file so that file should be What we say:

Logic circuit simulator should work from the console. The user program runs the program first
"Devre.txt" within the lines must be interpreted and run commands.
2. The console prompt (the warning) character '>' must see. In other words, the user is ready to take command
shows that.
3. When one of the following commands, depending on the user that the command is executed after the new process
for the command prompt (warning) character '>' must see on the console. (C-output-to command is entered.)
4. The commands does not matter whether large caps or small caps. (Not case sensitive)


commands:
> H <giriş/çıkış biri/birileri> on the tip end / ends logic-1 does
> L <input / output end of the …

zeroliken 79 Nearly a Posting Virtuoso

“Don't be afraid to make a mistake. But make sure you don't make the same mistake twice.”

-Akio Morita

zeroliken 79 Nearly a Posting Virtuoso

I started when I was in college which is still recent

The language I first learned was C and the first program I made is the Hello World program which was fun

zeroliken 79 Nearly a Posting Virtuoso

You could use ctype.h functions like tolower and toupper