User Profile

Collapse

Profile Sidebar

Collapse
nilushika
nilushika
Last Activity: May 30 '15, 04:15 AM
Joined: Sep 14 '13
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • nilushika
    started a topic Value return by a method does not change???
    in C

    Value return by a method does not change???

    Hi this is my simple c++ programme, it has Thermister class which calculate resistance when varying Temp,but each time when calling to setTemp() eventhough it change value of Temp,value given by getResistance() mthd does not change.It always gives 1 when calling through a for loop.here is the code any help please...
    Code:
    #include <iostream>
    #include <cmath>
    class AbstractResistor
    {
    public:
    	virtual double
    ...
    See more | Go to post

  • nilushika
    started a topic why it says str not callable?

    why it says str not callable?

    Code:
    >>> li=[4,5]
    >>> map(str,li)
    
    Traceback (most recent call last):
      File "<pyshell#1>", line 1, in <module>
        map(str,li)
    TypeError: 'str' object is not callable
    See more | Go to post

  • nilushika
    started a topic multiply two matrices

    multiply two matrices

    python
    Code:
    def readmat(r,c):
        for i in range(r):
            list=[]
            str=raw_input()
            templist=str.split()
            raw=map(int,templist)
            list.append(raw)
        return list
    
    def product():
        list=[]
        for i in matA:
            sublist=[]
            print i[3],matB[1][1]
            for x in range(3):
                sum=0
                for e in range(4):
    ...
    See more | Go to post

  • nilushika
    started a topic Decripting does not happen properly.
    in C

    Decripting does not happen properly.

    this programme is to encripta text with a key and decript that text again into real language.but the matter is when I enter text "attack the base" and the word "kill" as the key and decript the text with the same key"kill",outpu t is only "a",why it dose not print all the text?is it due to global variable a[]?could u please help me?
    Code:
    #include<stdio.h>
    #include<stdlib.h>
    char a[100]={'\0'},key[4];
    ...
    See more | Go to post

  • java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representa

    here is my code.but there is something wrong when I using BigDecimal class.
    Code:
    package javaapplication30;
    
    import java.math.BigDecimal;
    
    public class Main {
    
      public static void main(String[] args) {
       Main a=new Main();
    	 BigDecimal sum=new BigDecimal(0);
    	for(int i=3;i<=100;i++){
           
                sum=a.R(i).add(sum);
                    
    	}System.out.println(sum);
    ...
    See more | Go to post

  • nilushika
    replied to code error with a recursivefunction
    in C
    I was able to find the errors,there must come a "else" after
    "if",and also don't need to y--;now it works:)
    Code:
    #include<stdio.h>
    void finder(int x,int y);
    int max=0;
    int tot;
       int a[15][15]={{75},{95, 64},{17, 47 ,82},{18 ,35 ,87 ,10},{20, 04, 82 ,47 \
       ,65},{19 ,01, 23 ,75, 03, 34},{88 ,2, 77 ,73, 7, 63, 67},{99 ,65, 4 ,28, 6,\
     16, 70, 92},{41 ,41 ,26, 56 ,83 ,40, 80 ,70, 33},{41,
    ...
    See more | Go to post

    Leave a comment:


  • nilushika
    started a topic code error with a recursivefunction
    in C

    code error with a recursivefunction

    Thing I want is find the largest sum down a triangle,(movin g to adjacent numbers on the row below )there are many methods to go down.
    75
    95 64
    17 47 82
    18 35 87 10
    20 04 82 47 65
    19 01 23 75 03 34
    88 02 77 73 07 63 67
    99 65 04 28 06 16 70 92
    41 41 26 56 83 40 80 70 33
    41 48 72 33 47 32 37 16 94 29
    53 71 44 65 25 43 91 52 97 51 14
    70 11 33 28 77 73 17 78 39 68 17 57
    91 71...
    See more | Go to post

  • nilushika
    started a topic why can not use strcat() in below c code?
    in C

    why can not use strcat() in below c code?

    when I try to run this it throws a runtime error.
    Code:
    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    void savefile(char *p);
    int main(){	
    savefile("c proramming"); 
    }
    void savefile(char *p){
      	FILE*fp;
    	fp=fopen("result.txt","w");
    	if(fp==NULL){
    		printf("error");
    		exit(0);
    	}
    	strcat(p,"\n");//line
    ...
    See more | Go to post

  • nilushika
    replied to recursive functions with arrays as parameters
    in C
    Thank for all.....
    See more | Go to post

    Leave a comment:


  • nilushika
    replied to recursive functions with arrays as parameters
    in C
    Thank you Nepomuk, that's the point!
    I made line 25 as ' store[0]=qtnt;'I have forgot it.
    Now it works ....
    thnks for the all.
    See more | Go to post

    Leave a comment:


  • nilushika
    replied to recursive functions with arrays as parameters
    in C
    i compiled this with c-free5.0.it compiles fine.i'd like to know what the error is,please.
    See more | Go to post

    Leave a comment:


  • nilushika
    started a topic recursive functions with arrays as parameters
    in C

    recursive functions with arrays as parameters

    I wrote a fuction in C with the prototype
    'void raisePowerOf2(i nt array[],int pow);'

    If someone want to find the value of 2^456 ,just have to invoke this function 456 as the value for pow and int array with 2 elements :1 & -1 as the argument for the array.(There I used -1 to denote the end of the array.)

    But it seems that this function doesn't give the exact answer

    And I tried this from java also,with...
    See more | Go to post

  • yes Banfa,you are correct.this is a mistake happened when I post it.result is same even after 0 replaced by n.
    can't we actually use fread/fwrite for text files?then how can i fix it?what should be the extention?
    See more | Go to post

    Leave a comment:


  • ...
    See more | Go to post

    Leave a comment:


  • I want to store the finally modified array in the store.txt.


    In the each time this code run I read the previosly stored array and append new data to it.
    for example think that in the previous session I have filled the array cell 1.then next session I fill the array cell 2.

    Like that I continued the filling array,But previously stored data should remained,(altho ugh it overriden the array each time:because previously...
    See more | Go to post

    Leave a comment:


  • what I just wanted in this progrrame is that.it means i want to modify the array each time & restore it .so data gets written on top of previous data at the beginning of the file is not a problem.
    See more | Go to post

    Leave a comment:


  • nilushika
    started a topic help to detect errors in this simple proggramme
    in C

    help to detect errors in this simple proggramme

    help to detect errors in this simple proggramme

    Code:
      	
        #include<stdio.h>
        #include<ctype.h>
        #include<string.h>
        struct customer readCustomer();
        struct slot readSlot();
        struct slot{int day,period;};
        struct customer{
        char name[50],tel[10], paidOrNot[8];};
        struct booking{
            char freeOrNot;//if not free, gives
    ...
    See more | Go to post

  • nilushika
    replied to how to store 50 digit number in c laguage?
    in C
    50 digit means too large ,even 'long double' cannot hold such one!
    See more | Go to post

    Leave a comment:


  • nilushika
    replied to how to store 50 digit number in c laguage?
    in C
    can someone please help me?
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...