Programming :: Build A Simple Program For C Programming Class?

Feb 12, 2011

im trying to build a simple program for my C programming class, this is the source code

#include <stdio.h>
int main()
{
int length, width, length, height, area, perimeter;
perimeter = width + length + height;
area = width * length + heigth;

[Code]...

i dont see any error (you might)but every time i run it it runs but after it asks me to input for the width i do it but it doesn't take me to the length, it just stays blank until i input another value in the same place for the width, it asks me for 4 inputs in total i don;t know why, and after i run it different times it gives me different values for the perimeter and are. how can I fix this?

View 5 Replies


ADVERTISEMENT

Programming :: How To Compile / Simple Tutorial For Making Simple Program

Oct 7, 2010

i'm a college student studying pc programing, and i was given today a special work and i have to program using miranda... which i've never used it >.< can anyone give me a hand to where to download, how to compile, and a simple tutorial for making a simple program or something?

View 3 Replies View Related

Programming :: Worker Class For Program Coordinator?

Mar 9, 2010

Here's what I'm trying to do: I'm attempting to create a Worker program which is to be called in a Coordinator program. The worker program needs to add two numbers from the argv and return the sum of those numbers. Basically my problem is some sort of syntax and I'm fairly new to this scripting stuff. Here's what I have:

#!/bin/bash
# Worker class for the program Coordinator
int worker(int argc, char *argv[] {
int sum = 0;
sum = atoi(argv[1]) + atoi(argv[2]);
printf("I am child with PID %d", getpid());
printf("sum=%d
", sum);
fprintf(atoi (argv[3]), sum, 4);
exit(sum); }

Here's the errors:
~$./worker 2 4
./worker: line 4: syntax error near unexpected token `('
./worker: line 4: `int worker(int argc, char *argv[]'

View 5 Replies View Related

Programming :: Linker Error For A Singleton Class Program

May 5, 2011

I am getting a linker error for a simple program to represent a singleton class.

Find below the program which I have written:

View 3 Replies View Related

Programming :: How To Write Simple C Program In RHEL5

Sep 17, 2010

How can i write a simple c program in my RHEL5?I am more concerned about what are toosl i need to install to get a C platfrom running in my RHEL5?

View 14 Replies View Related

Programming :: Build A Spi Program Using C++?

Jan 19, 2011

I'm trying to build a spi program using c++. I'm able to perform half-duplex transfers using the read/write functions, it works perfectly. Now I need to perform a full-duplex transfer, but I'm facing some problems. When I try to receive more than one byte, the slave returns to me only one byte.Ex: I send: FF FF FF FF FF The slave must return: 03 02 00 13 04 But what is happening is:

1st Transfer:

tx: FF FF FF FF FF
rx: 03 00 00 00 00

2nd Transfer:

tx: FF FF FF FF FF
rx: 02 00 00 00 00

[code].....

View 3 Replies View Related

Programming :: Simple Download Scheduler Program Code?

Apr 30, 2010

I have created a simple download schedular with source-code give below :

---------------------record_strokes.sh-------------------
touch /home/student/packs/lynx/logfile
lynx -cmd_log /home/student/packs/lynx/logfile

[code]....

View 10 Replies View Related

Programming :: Call_usermodehelper - Loading A Simple C++ Program Like Hello World With Driver

Dec 13, 2010

all i want is loading a simple c++ program like hello world with this driver. everything works fine except it doesnt start the program. because ret returns with 0 i think the program works fine but I think i messed up something about how to start the c++ program. i used this example for my program but it doesent work too.

[URL]

is there anybody out there who can give me a hint what i messed up? i use ubuntu with 2.6.32 Kernel.

[Code]....

View 1 Replies View Related

Programming :: Write A Simple Character Printing Program Using NASM?

Jul 27, 2010

i tried a code to accept a character and print the same ! i can accept it with following code but its not working with printing that character i use NASM version 2.07

Code:

segment .data
msg1: db 'Enter a key',10
msg1len: equ $-msg1

[code]....

View 3 Replies View Related

Programming :: Errors - Make Pop-up Reminders For The Simple Calendar Program?

Feb 21, 2010

First off, I'm completely new to bash scripting so forgive me if I make any egregious errors. I'm trying to make pop-up reminders for the simple calendar program when. This is what I have so far:

Code:
#!/bin/bash
# set the time format for when
#current="$(date +%I:%M %p)"
current="$(date +%-l%p)"
today=~/.when/today

[Code]....

When I run the script, gxmessage pops up and displays the correct information, but it does so for each line in "~/.when/today" that contains a time that matches the current system time (which would be three pop-ups at 10PM, according to the example). I want it to display the information only once. How can this be accomplished? Is a while loop even the right job for this?

View 8 Replies View Related

Programming :: How To Use X86 To Build Assemly Program For Arm Machine?

Apr 14, 2011

my build machine is x86 machine that is running ubuntu10.04, my target machine is tegra2 that is running on Andrioid, I wish my program can run under shell of android, as first step , I wrote a simplest assembly program which does nothing, but I got a link error, can somebody help me?

View 4 Replies View Related

Programming :: Compile And Build Program Using A Makefile Template?

Jul 8, 2011

I am new to the whole concept of makefiles, and I'm trying to compile and build my program using a makefile template I have found. My project consists of three directories: "source", where my .cpp files are (source1.cpp, source2.cpp, source3.cpp), "include", where my .h files are (header1.h, header2.h, header3.h), and "obj", where the object files are to be stored (obj1.o, obj2.o, obj3.o). In the project root directory is my makefile, which is as follows:

Code:
EXEC = myexe
CC = g++
IDIR = include
SDIR = source
ODIR = obj

[Code]..

View 4 Replies View Related

Programming :: Create A Simple Program With Will Continually Read Input From The User Until They Enter A Blank Line?

Apr 6, 2011

basically i have to create a simple program with will continually read input from the user until they enter a blank linei know how to read in certain input but not sure how to get it continually in a loop

View 2 Replies View Related

Programming :: C++ Programming With Simple RTAI Functions Outputing Words?

Apr 11, 2011

I need help as I am not proficient with Linux C++ Programming. There are two parts which I need to do in the coding provided below.

1. Produce the program so it can output the word "Hey there!" and wait two minute and print the word "See you later!".

2. Produce the program that will output the text "Cool" every 20 seconds by setting a periodic task.

Quote:
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
int init_module(void)
{
printk("Hey there!

[Code]...

View 3 Replies View Related

Programming :: Build Ip Packet With C,socket Programming?

Jan 30, 2011

How can we build a packet using C?we have a structure called sockaddr_in which is use to for IPv4,so that we can define address,port and etc in this way:

Code:
struct sockaddr_in sock;
sock.sin_family=AF_INET;

[code]...

View 5 Replies View Related

Programming :: Passing Class To Itself (CPP)?

May 18, 2010

I'm struggling with the issue of passing a vector of a class to itself, here's what state its in now... (tried many variations, but without direction).

Code:
#include <iostream>
#include <string>

[code]...

View 2 Replies View Related

Programming :: C++: Defining A New Class - Periodic B.c?

Apr 9, 2010

I am trying to make a periodic boundary condition type function, using an existing class given to me in lecture notes, but am having some trouble! Effectively, I am trying to make an array such that, for a point in any row of a 2D matrix ("Matrix(i,j)"), the command "next_i[i]" will return "(i+1)%L", where L is the number of data points in the row. This will enable me to select a point to the right of any point in the matrix: "Matrix(next[i],j)"

[Code]....

View 1 Replies View Related

Programming :: Use A Class Inside A Struct?

Apr 8, 2011

Is is possible to use a class inside a struct? I keep getting segmentation fault with this code:

Code:

struct my_struct {
unsigned count;
std::string msg;

[code]....

View 3 Replies View Related

Programming :: Unable To Compile Class For JSP?

Mar 15, 2011

My new guy has created several functioning webpages on his machine with TOMCAT 6 with Sun JDK, yet our machines use TOMCAT 5.5 with Open JDK, which his webpages don't show. Do you have any idea how to make them work? The error showing in a browser:

Code:
HTTP Status 500 -
type Exception report
message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception org.apache.jasper.JasperException: Unable to compile class for JSP:

[Code]...

View 2 Replies View Related

Programming :: How To Set Up Global Class In JAVA?

May 10, 2011

I've had to do some code in java, a language I'm very much unfamiliarly with so please excuse my incorrect use of terms. The basic outline of my problem is I create a class object as a local within a swing button function it works fine. If I create it as a global ( with I think I need to do ) within main, then prototype it with the other swing objects at the bottom of the file when it is called it causes a host of problems. I think the easiest way is to show it.

View 2 Replies View Related

Programming :: How To Modify ArrayList From Outside Of Class?

Mar 10, 2010

Okay so I'm working on a program here as I'm learning java,I have an array that is initialized with 5 objects that are hard coded. I have made a GUI that takes the input needed and creates an object with those values.I need to add that object to the ArrayList that I have previously made.Okay, so I have three classes, guiclass.java, main.java and gladiator.java Objects are made and defined in "gladiator".Main contains my public static void main section, launches my gui, creates my five hard coded objects, creates my ArrayList and adds my five hard coded objects to the ArrayList.Now, I need to add the object that I generated in the guiSection [action Listener]to the ArrayList that I created in my main class's public static void main string... section. Problem is my arraylist "cannot be resolved" from guiclass.

View 13 Replies View Related

Programming :: Md5 In Java Without Using MessageDigest Class

Sep 18, 2010

I am looking to write a function to return an MD5 hash in Java but I don't want to us the MessageDigest class as I am using the J2ME framework which doesn't include it.

View 3 Replies View Related

Programming :: Php And Variable Class Names?

Sep 30, 2010

How can I handle the situation below so that the "Fatal Error" message is not shown. It would be ideal if I could supply a default class to be used. I'd prefer to not use: ini_set() to supress the errors but actually be able to "handle" the error.

Code:
<?php
class MyClass

[code]....

View 2 Replies View Related

Programming :: Possible To Communicate Values Between Class?

Feb 24, 2009

I have a application in C++, and now I have two class. MyDialog is the class that main function launch. In MyDialog class there are four elements and when I click over theese elements, there is a MousePressEvent that launch other class, Touchpad class. So, in some moments, I have loaded two class. My question is, how can pass a value from Touchpad class to MyDialog class, when I close (destroy) Touchpad class. In a few words, is it possible to communicate values between class?

View 5 Replies View Related

Programming :: Implement A Set Class (like In Stl) Using A Vector?

Sep 3, 2010

i need to implement a Set class(like in stl) using a vector.Here is my code that doesnt work corectly:

Code:
#include <iostream>
#include <vector>
template<class T>
class Set
{

[Code]....

View 2 Replies View Related

Programming :: Implement C_str() For A String Class?

Oct 19, 2010

How can I implement c_str() for a string class?

View 2 Replies View Related

Programming :: Declaring A Vector Inside A C++ Class?

Mar 23, 2010

Is it not possible to declare a vector inside a C++ class ? Have a look at the following code:

Code:

#include <stdio.h>
#include <iostream>
#include <malloc.h> // malloc
#include <strings.h> // bzero

[code]....

View 2 Replies View Related

Programming :: Default Port For UDPWriter Class?

May 9, 2011

This is a really specific question, but maybe someone can help. I'm debugging someone else's code, and they call a UDPWriter and specify an IP address and port, and I'm trying to make sure this multicast traffic goes over a certain port. How can I determine which port the UDP defaults to and change it?

It's confusing to me because I'm not familiar with all the layers the OS sends traffic through before it goes through the interface. Is there maybe some simpler way to tell the OS to send multicast traffic over both interfaces?

View 2 Replies View Related

Programming :: Function Pointers To Class Members Cpp

May 23, 2010

i'm a bit stuck playing with the following class setup for glut. The actual issue is with the function pointers.Basically the following code is the opengl redbook cube example slightly modified.

View 2 Replies View Related

Programming :: Getting Undefined Reference To Main In Sub-class For BST?

Apr 27, 2011

I'm writing a binary search tree class to insert records and I'm stuck on the following error:

Code:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
Here is the code for my class:

[Code]...

I really don't know how to approach this, I thought that everything was working fine but I have no idea what is wrong. Also, for clarification, main() is in a different .cpp file that #includes "tree.h"

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved