30 Topics

Member Avatar for
Member Avatar for chozotheqhai

Currently doing C programming homework, I want to update the value in the file. But now I'm having a problem updating it. The problem I faced now was the codes below update the values but in the form of new lines. Instead of replace the original lines. What's wrong with …

Member Avatar for rubberman
0
221
Member Avatar for zegarnek

Hi, I do not think this is a problem as such but an interesting behaviour to watch. I have little piece of C (to do with trying later Unicode, Polish characters and text files). I was trying to find a position of a Polish character in the alphabet string. Had …

Member Avatar for zegarnek
0
402
Member Avatar for William_6

hello, I created a awk program to work witha data file to output a table and subtotal the rows and total up the collums and average I got it to work but when i added a presentation header before my totals go away. working code so far ------ can be …

Member Avatar for William_6
0
226
Member Avatar for DeadH34d

Hey guys, I'm working on a tip calculator as an excercise from the book I'm using to learn Java, and I've run in to a bit of a problem. When I run this code: import java.util.Scanner; public class TipCalculator { public static void main(String[] args) { Scanner input = new …

Member Avatar for DeadH34d
0
253
Member Avatar for ram619

Hello, the output of this code is 'ef' but if we add up a "newline" print after this print then the output becomes 'efd'. Then why in earlier scenerio the 'd' was not getting printed ? Thanks in advance. #include<stdio.h> int main() { printf("\nab\bcd\ref"); }

Member Avatar for Rahul47
0
508
Member Avatar for milkman93

Hey Guys, I'm want to output a calculation to a JLabel. Example: double num1 = 14; double num2 = 3; double ans; ans = num1/num2; JLabel jl = new JLabel(); add(jl); jl.setText("The Answer is: " + ans); Currently the answer for this will be 4.666666667. Now if this was a …

Member Avatar for milkman93
0
5K
Member Avatar for mohamed.rani

want to change all printf to cout with keeping the same output #include <iostream> using namespace std;Heading Here void main() { unsigned int a,b,c; char*format1 , *format2; format1 = "%04x%s%04x=%04x \n"; format2 = "%c%04x=%04x \n"; a = 0x0ff0; b = 0xf00; c=a>>4; printf (format1,a,">>",4,c); c=a&b; printf (format1,a,"&",b,c); c=a|b; printf (format1,a,"|",b,c); …

Member Avatar for Ancient Dragon
0
170
Member Avatar for xikhari.some1behindu

I need help with this http://codepad.org/FNUci22s I am posting the ling of code pad because it has a way to execute it, so long story short. I use two different functions seno, sen (both for sin). When using the printf and adressing both to compare results I get from the …

Member Avatar for xikhari.some1behindu
0
264
Member Avatar for xEffrego

My code is this atm: #include <stdlib.h> #include <stdio.h> int main(int argc, char *argv[]){ int a,b,c; int swap; printf("Enter 3 Numbers (# # #):"); scanf("%d %d %d", &a,&b,&c); //does all its computing, to see which one is biggest. return EXIT_SUCCESS; } The result when i run it in eclipse is …

Member Avatar for WaltP
0
2K
Member Avatar for DanOath

I am supposed to write a method to display a pattern as follows: ________1 _______21 ______321 _____4321 ____54321 ___654321 __7654321 _87654321 987654321 (underscores are simply placeholders to show alignment on my post they are not actually part of the printout) My program works and prints the aforementioned code correctly, however …

Member Avatar for zeroliken
0
396
Member Avatar for slygoth

Hey guys i need to color code [CODE] printf("hello World");//how do i change this to green printf("How are you");//How do i change this to yellow or something [/CODE] How do i change the color of the text inside the printf

Member Avatar for Ancient Dragon
0
136
Member Avatar for ineedsomehelp:3

[CODE]void alternate(char wordWord[][MAX],char wordVar[],int word[],int i,int j, int k, int l) { char ang[4],si[3],ni[3],ay[3],sa[3],kay[4]; int X,Y,Z1,Z2; strcpy(ang,"ang"); strcpy(si,"si"); strcpy(ni,"ni"); strcpy(ay,"ay"); strcpy(sa,"sa"); strcpy(kay,"kay"); tokenize(wordWord,wordVar,word,i,j,k,l); if(wordWord[j][k] == ang[4] || wordWord[j][k] == si[3]) X = wordWord[j][k]; else if(wordWord[j][k] == ni[3]) Z1 = wordWord[j][k]; else if(wordWord[j][k] == ay[3]) Y= wordWord[j][k]; else if(wordWord[j][k] == sa[3] …

Member Avatar for ineedsomehelp:3
0
328
Member Avatar for mBrissman

Hello! I have a problem. I can't use scanf() to set a value of the second member of the person struct. Why? I get an error that tells me "bad access". [CODE]int main(int argc, const char * argv[]) { struct Adress{ char *street; char *postal; int zip; }; struct Person{ …

Member Avatar for mBrissman
0
1K
Member Avatar for srinath1

inr main () { int x=3,y=4,z=4; printf("%d",z>=y>=x), } the answer is zero ..how??

Member Avatar for sharathg.satya
0
177
Member Avatar for denethor

Hello, I have this code: [CODE] #include <iostream> #include <string> void main() { std::string a = "Sample"; printf("%s", a); std::cin.get(); } [/CODE] and it prints some I think random letters. Where i made mistake? And how should i change the code to write "Sample"? Thanks for answers and sorry for …

Member Avatar for denethor
0
207
Member Avatar for starlight849

I'm using the printf function to display some textual information. It is possible that the string may contain different symbols such as $#%^&* somewhere within the text. I know that to handle the % that I need to use a %% to make the string evaluate correctly. for example: [CODE] …

Member Avatar for starlight849
0
198
Member Avatar for deluksic

Well... im making some kind of graphic engine for console in [B]c++[/B], ASCII based, just for exercise... anyways, i was wandering, can i print text [B]faster[/B]? Right now i'm printing the whole map of characters (pix[160][120]) in a [B]single line[/B], so it is fast, however i need it faster cause …

Member Avatar for deluksic
-1
2K
Member Avatar for ThomsonGB

//////////////////////////////////////////////////////////////////////////////////////// // In this little project I am trying to learn to get and manipulate data from // a file input using fstream strings I also wanted to use the formating available // with the printf and related string handling methods. I have a question in regards // to the …

Member Avatar for ThomsonGB
0
255
Member Avatar for theofilos93

In a language named vJass I can do this: [CODE] function Initialization takes nothing returns nothing string array s call read(s[1]) call read(s[2]) call print(s[1] + " " + s[2]) endfunction[/CODE] It takes two strings from user and prints them. I am totally confused how I can do this in …

Member Avatar for hkdani
0
280
Member Avatar for Shodow

can u help me convert the cout to printf..i dont have a clue how.. tnx [CODE]#include<iostream.h> #include<string.h> #include<conio.h> int findSimilar(char[],char[]); void checkValue(int,int); int main(){ char boy[50]; char girl[50]; int similarInBoy=0; int similarInGirl=0; int total; clrscr(); cout<<"Enter Boy's Name: "; cin.getline(boy,50); cout<<"Enter Girl's Name: "; cin.getline(girl,50); similarInBoy=findSimilar(boy,girl); similarInGirl=findSimilar(girl,boy); total=similarInGirl+similarInBoy; cout<<"Boy: "<<similarInBoy<<","; …

Member Avatar for Narue
0
549
Member Avatar for hackit

i found a very simple program that is very simple but have a great logic. [CODE] #include<stdio.h> #include<conio.h> void main() { int B=1; printf("%d\n%d\n%d",b=15,b>9,b<9); getch(); } [/CODE] this seems very simple to me but the output is very strange to me OUTPUT:- 15 0 1 I tried very much to …

Member Avatar for Narue
0
150
Member Avatar for gynmd

hello, can someone explain me how this printf inside the function works? [CODE] #include<stdio.h> #define SIZE 10 void function(int [],int); int main() { int a[SIZE]={32,27,64,18,95,14,90,70,60,37}; function(a,SIZE); return 0; } void function(int b[],int size) { if(size>0){ function(&b[1],size-1); printf("%d ",b[0]); } } [/CODE]

Member Avatar for gynmd
0
170
Member Avatar for DNHK

hello everyone umm I'm having trouble in printing a structure in c... is a program to calculate benefits of employees in a company when they are fired.. getting trouble when printing the hired date of an employee here its the code [CODE]#include <stdio.h> #include <conio.h> #include <stdlib.h> void menu(); struct …

Member Avatar for TrustyTony
0
235
Member Avatar for nightcracker

Hi! I've recently converted some C code to a bit more native C++. This included changing printf() statements to std::cout statements. However, some printf()'s are rather lengthy and annoyingly long (and human-error-prone) to write in std::cout. Example (and this one is a short one): C-style: [CODE]printf("ERROR %d: %s: %s\n", event, …

Member Avatar for mike_2000_17
0
726
Member Avatar for atoklas

The following lines of code output "FFFFFFFF" #include <stdio.h> int main(void) { int i; i=-1; printf("\n%X\n",i); return 0; } This is the 32-bit representation of -1 in Hex. I'm trying to get it to output fewer bits: e.g. 24-bit: FFFFFF In fact, the output I want needs to be 6 …

Member Avatar for Trentacle
0
256
Member Avatar for deepak_1706

I came across these to statements and i am not sure how they are parsed and the output given is produced... [CODE] printf("%d",printf("%d %d",5,5)&printf("%d %d",7,7)); [/CODE] o/p : 5 5 7 7 3 [CODE] printf(" %d %d",printf("%d %d",7,7),printf("%d %d",5,5)); [/CODE] o/p : 5 5 7 7 3 3 Could some …

Member Avatar for hyperion
0
154
Member Avatar for qqwushi12345

Write a program that displays the table of Fahrenheit - Celsius temperatures. Below is my code, the problem with it is that the celsius column is all zeros,please correct my mistake, thank you: [CODE]#include "stdafx.h" #include "genlib.h" #include "simpio.h" #include "math.h" int _tmain(int argc, _TCHAR* argv[]) { int i; double …

Member Avatar for qqwushi12345
0
3K
Member Avatar for junezy4

I need the coding for the following question in C: Read and print all the consonants from a file (no duplicates). Assume the file is a .txt file. The consonants are then to be sorted in alphabetical order.

Member Avatar for Ancient Dragon
-6
163
Member Avatar for rjani1

Dear all, I am working on the code below: [CODE] int cookTime(int time) { int second, minute; for (minute = time; minute > -1; minute--) { for (second = 59; second > -1; second--) { sleep(1); printf ("%i", minute); printf (" : %i\n", second); } } } [/CODE] Now this …

Member Avatar for rjani1
0
1K
Member Avatar for majestic0110

Hi all, I hope you are well. I am trying to compile a java file using terminal in Ubuntu, but I am getting the following error message: [QUOTE]1. ERROR in StringComparisons.java (at line 20) System.out.printf("String a = %s String b = %s \n", a,b); [/QUOTE] As you can see, I …

Member Avatar for quuba
0
234

The End.