baby_c 37 Junior Poster

Or you could use code blocks.

Personally, why have an IDE for c++/c.

This is linux, why aren't you using vi with g++ from the command line!

yeah!i'm using command line.but i needed gui.because i used to use cfree when i'm using windows.now i'm totally ubuntu.Still learning(With u guys help).

baby_c 37 Junior Poster

thanks guys..

baby_c 37 Junior Poster

Hello download CodeLite and use it, it is specifically designed for C/C++ with focus only on that. As per your problem, where did you put project files?
try this:
create folder under Home that is
cd and press return key
then cd Documents/
mkdir Projects
cd Projects/
mkdir CandC++
then when creating new workspace in codelite, create it under /home/your_name/Projects/CandC++/workspace_name

Voila!

thanks for the advice..codelite works perfectly... thanks friend.

baby_c 37 Junior Poster

i chmod the directory to 777 but problem still not solved.what can i do??

baby_c 37 Junior Poster

oh! god help me..i'm on another problem..i have installed Anjunta IDE and no problem with installation.when i try to execute my program theres a error massage " Program '/home/sudheera/c/puts.o' does not have execution permission".
what does it mean.my account is the only one in this computer and i think it have administrator privileges.i'm using 10.04.please anyone can help me...?

baby_c 37 Junior Poster

I have install eclipse.but it seems like a java editor not C. so i'm going to try CodeLite.However thanks a lot guys.

baby_c 37 Junior Poster

yeah! i gonna try eclipse.thanx for the tip..

baby_c 37 Junior Poster

hey friend i need some help here since i'm new to ubuntu(to linux also)...this is the problem.

i installed wine on ubuntu 10.04 and install c-free 4.1 .The installation is completed with no errors.and c-free is working perfectly except its unable to output any thing to terminal.Is there any way to solve this?(or a software same to c-free working with ubuntu) please pay your kind attention to this guys.
thank you in advance

baby_c 37 Junior Poster

hey,actually that code didn't give me the error.it's a model one.this is the original one..

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>

void create(void);
void edit(void);
void view(void);
void menu(void);

main()
{	
	menu();
}

void menu()

{
	int i,t;
	
	printf("-----------------------------------\n            Results Database               \n-----------------------------------\n");
		printf("\t\n\nWhat do you want to do?\t\n\n");
	printf("\t\tCreate new database---------[1]\n");
	printf("\t\tEdit exiting database-------[2]\n");
	printf("\t\tView database---------------[3]\n");
	printf("\t\tExit------------------------[4]\n\n");
	
	printf("Choose a option\t:\t");
	scanf("%d",&i);
	

		switch(i)
	{	
		case 1:
		create();
		
      /*	case 2:
		edit();
		
		case 3:
		view();        */
		
		 case 4:
		 exit(1);
		 
	default:
			{
		                printf("\n\n\n     ***    Incorrect input   ***              ");
				system("cls");
				menu();
			}
			
	}

}


void create()
	{

	int i,j,k;
	char name[30],fname[30],z[5];

	FILE *fp;
	fp=fopen("C:\\database.txt","w+");
	
	if(fp==NULL)
	{
		printf("Error\n");
		exit(1);
	}
	system("cls");
		for(i=0;i<4;i++)
	{	
		fflush(stdin);
		printf("Student no.%d name  :",i+1);
		gets(name);
		strcat(name,"\n");	
		fputs(name,fp);
			
			strcpy(fname,name);				
			for(j=0;j<31;j++)				
			{								
				if(name[j]==' ')			//
				fname[j]='\0';				//
			}								
				

	printf("%s's z-score  :",fname);

		gets(z);
		
		fputs(z,fp);
	
		fputs("\n",fp);

	system("cls");		//clear the screen
	

	}
	
	
	
	fclose(fp);
	
	menu();
}

is that ugly too ?????

baby_c 37 Junior Poster

yeah,it;s nonsensical code.with you guys help,i'm going to write better codes.thanks for your post Aia..it's very useful for me.

baby_c 37 Junior Poster

thanx for the lesson bro.

baby_c 37 Junior Poster

this is not the program which i'm building.i wrote this to present my problem.now it's solved.but unable to understand the theory part of it.(i mean how the program works correctly after write fflush(stdin); )

baby_c 37 Junior Poster

hey..i've figure out that whats wrong with this.it's caused due to buffer.once clean the buffer and no more errors

#include<stdio.h>
void pri(void);

main()
{
	int x;
	
	printf("enter a value	:");
	scanf("%d",&x);
	
	switch(x)
	{
		case 1:
		pri();
	}
	
	
}
void pri()
{
	
	int i;
	char z[30];
	for(i=0;i<4;i++)
	{
		fflush(stdin);
		printf("enter string:");
		gets(z);
	}
}

thanx Aia for trying to help.but i still unable to understand whats happned .can you explain ??

baby_c 37 Junior Poster

screen clipping attached..

baby_c 37 Junior Poster

i try to learn this..this is not the original program.bt same structure and gives the same error.

when program start to looping it prints "enter string: enter string: "
thats the error..

baby_c 37 Junior Poster

hey guys i'm new to c and still learning.need some help here.

i wrote this code and it isn't work properly,unable to figure out whats wrong!!but when the strget() call from the main() its working.please some help...

main()
{
	int x;
	
	printf("enter a value	:");
	scanf("%d",&x);
	
	switch(x)
	{
		case 1:
		pri();
	}
	
	
}
void strget()
{
	int i;
	char z[30];
	for(i=0;i<4;i++)
	{
		
		printf("enter string:");
		gets(z);
	}
}