Question about Operating Systems

1 Answer

C++ kindly find and debug this program #include #include void main() {char buffer[max]; clrscr(); ofstream out ("OUTPUT", ios::in|ios::out); if(!out) {cerr<<"Open failed\n"; exit(1); }cout<<"Enter a line of data:"; while(cin.get (buffer, max) == eof()) {put<<<< "Next line: "; } getch(); }

Posted by on

1 Answer

Good

Posted on Feb 23, 2008


Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Write a program that will accept any whole number and it will determine if the number is divisible by 5 or not


#include <conio.h>
#include <iostream.h>
void main()
{
clrscr();
int a;
cout<<"Enter a number"<<endl;
cin>>a;
if (a%5==0)
cout<<a<<" is divisible by 5"<<endl;
else
cout<<a<<" is not divisible by 5<<endl;
getch();
}

Aug 22, 2011 | Operating Systems

4 Answers

I need program source code for vertical redundancy check,longitudinal redundancy check,isochronous communication


#include<iostream.h>
#include<conio.h>

void main()
{
char bin[10],c;
clrscr();
cout<<"\n\n\n\nEnter 8 bit binary no.:";
cin>>bin;
cout<<endl;
for(int i=0;i<9;i++)
{
if(bin[i]=='1')
{
c++;

}


}
i++;

if(c%2==0)
{
bin[8]='0';
cout<<"Even";

}
else
{
bin[8]='1';
cout<<"Odd";
}
cout<<bin;
bin[9]='\0';
getch();
}

Feb 21, 2009 | Microsoft Windows XP Professional for PC

2 Answers

Not getting the output on the screen


Try writing it like this ...


#include <iostream>
using namespace std;

int main ()
{
cout << "welcome to the world of c++! ";
return 0;
}

Nov 14, 2008 | Microsoft Windows Vista Home Premium with...

1 Answer

C code


try this Code

  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<alloc.h>
  4. void main()
  5. {
  6. int i, j,n,*p,check=1, blank, memspace, mem=0, rowdiff=1;
  7. printf("Enter the no. of rows to be printed :");
  8. scanf("%d",&n);
  9. blank=n-1;
  10. memspace=((n*(n+1))/2);
  11. p=(int*)malloc(sizeof(int)* memspace);
  12. for(i=0;i<n;i++)
  13. {
  14. printf("\n");
  15. for(j=0;j<blank;j++)
  16. printf(" ");
  17. for(j=0;j<check;j++)
  18. {
  19. if(j==0 || j==(check-1))
  20. p[mem]=1;
  21. else
  22. p[mem]=p[mem-rowdiff] + p[mem-rowdiff+1];
  23. printf("%d ",p[mem]);
  24. mem++;
  25. }
  26. for(j=0;j<blank;j++)
  27. printf(" ");
  28. blank--;
  29. check++;
  30. rowdiff++;
  31. }
  32. getch();
  33. }
--------------------------------------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
void main()
{
int num,x,y,a[50][50];
clrscr();
fflush(stdin);

printf("Enter the number of rows: ");
scanf("%d",&num);

printf("\n\t\tPascal's Triangle of Order %d\n\n",num);

for(x=0;x<num;x++)
{
for(y=0;y<=x;y++)
{
if(x==y || y==0)
a[x][y]=1;
else
a[x][y]=a[x-1][y-1]+a[x-1][y];
printf("%4d",a[x][y]);
}
printf("\n\n");
}

getch();
}

Sep 20, 2008 | Operating Systems

1 Answer

To write a program


#include<iostream.h>
#include<conio.h>
void main( )
{
clrscr( );
cout<<"welcome to c++";
getch( );

Sep 12, 2008 | Operating Systems

1 Answer

Need code


Try the Following Five Programs

1) Program for Prime Number Generation

#include <stdio.h>
main()
{
int n,i=1,j,c;
clrscr();
printf("Enter Number Of Terms
");
printf("Prime Numbers Are Follwing
");
scanf("%d",&n);
while(i<=n)
{
c=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
c++;
}
if(c==2)
printf("%d ",i)
i++;
}
getch();
}
--------------------------------------------------------------------------------------------------------------------------------------------------

2)Program for finding the prime numbers

#include <stdio.h>
#include <conio.h>
void main()
{
int n,m,k,i,max;
char c;
clrscr();
repeat: max=0;
k=2;
n=1;
printf("You want prime numbers upto:- ");
scanf("%d",&max);
printf("

");
for (i=1;i<=max;i++)
{
again: m=(n/k)*k;
if (m!=n)
k=k+1;
else
goto try1;
if (k < n/2)
goto again;
else
printf("%d",n);
printf(" ");
try1: n=n+1;
k=2;
}
fflush(stdin);
printf ("

Do you want to continue?(y/n):- ");
scanf("%c",&c);
if (c=='y')
goto repeat;
getch();

}
---------------------------------------------------------------------------------------------------------------------------------------------------

3)
  1. #include <stdio.h>
  2. int main(void) {
  3. int n,
  4. lcv,
  5. flag; /* flag initially is 1 and becomes 0 if we determine that n
  6. is not a prime */
  7. printf("Enter value of N > ");
  8. scanf("%d", &n);
  9. for (lcv=2, flag=1; lcv <= (n / 2); lcv++) {
  10. if ((n % lcv) == 0) {
  11. if (flag)
  12. printf("The non-trivial factors of %d are: \n", n);
  13. flag = 0;
  14. printf("\t%d\n", lcv);
  15. }
  16. }
  17. if (flag)
  18. printf("%d is prime\n", n);
  19. }
---------------------------------------------------------------------------------------------------------------------------------------------------

4)

#include<stdio.h>

#include<conio.h>

void main()

{

int n,i,c=0;

clrscr();

printf("enter the number:");

scanf("%d",&n);

for(i=1;i<=n;i++)

{

if(n%i==0)

{

c=c+1;

}

}

if(c==2)

printf("number is prime");

else

printf("number is not prime");

getch();

}
-------------------------------------------------------------------------

5)
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("enter the number:");
scanf("%d",&a);
for(b=2;b<a/2;b++)
{
if(n%i==0)
{
printf("\n Its not a Prime number");
c=1;
break;
}
if(flag==0)
printf("\n Its a Prime Number");
getch();
}
}


Sep 02, 2008 | Operating Systems

2 Answers

C progarming language


i cannot write c program

Jun 24, 2008 | Operating Systems

2 Answers

C++ program


how to generate palindrome numbers through C++

Mar 21, 2008 | Operating Systems

1 Answer

Turbo c source code


#include<stdio.h>

float add(float,float);
float sub(float,float);
float product(float,float);
float divide(float,float);

void main()
{
float n1,n2;
char sym,choice;
printf("This Program is a program for calculator\n\n");
scanf("%f%c%f",&n1,&sym,&n2);
if(sym=='+')
printf("\n%f",add(n1,n2));
if(sym=='-')
printf("\n%f",sub(n1,n2));
if(sym=='*')
printf("\n%f",product(n1,n2));
if(sym=='/')
printf("%f",divide(n1,n2));
printf("\nDo you wish to continue[y/n]");
scanf("%s",&choice);
if(choice=='y'||choice=='Y')
main();
}

float add(float m1,float m2)
{
return(m1+m2);
}

float sub(float m1,float m2)
{
return(m1-m2);
}

float product(float m1,float m2)
{
return(m1*m2);
}

float divide(float m1,float m2)
{
return(m1/m2);
}

Feb 21, 2008 | Operating Systems

2 Answers

C code


sqrt value will do for u

Jan 23, 2008 | Operating Systems

Not finding what you are looking for?
Operating Systems Logo

Related Topics:

65 people viewed this question

Ask a Question

Usually answered in minutes!

Top Operating Systems Experts

Les Dickinson
Les Dickinson

Level 3 Expert

18304 Answers

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

Prashant  Sharma
Prashant Sharma

Level 3 Expert

1127 Answers

Are you an Operating System Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...