Harsh
And try with just cin.ignore()
Anonymous
Anonymous
Like 1 for int
Anonymous
And try with just cin.ignore()
Sure, that will also work but after wrong input the recursion doesn't work the way I want it to. It simply collects data infinitely
Harsh
Harsh
You ignoring 100 inputs I guess
Anonymous
Yes, not really needed though and yours is just efficient
Anonymous
But how do I fix the infinite recursion
Harsh
Pavel
strangely this code works for me 🤔
Anonymous
If input is valid, everything works fine, but when input is invalid, recursion occurs infinitely
Pavel
the only issue I had is replacing /n to \n
Anonymous
Anonymous
Pavel
oh, OK 😅
Anonymous
Guess I confused the slashes
Anonymous
Thanks to everyone
Anonymous
😊
Anonymous
Please help me! 🤕🤕
Anonymous
#include<iostream>
using namespace std;
int main()
{
int x, y, z;
cout<<"enter x and y and z \n";
cin>>x>>y>>z;
if (x>y && x>z)
cout<< x <<"\n";
else if ( y>z );
cout<<y <<"\n";
else
cout<<z<<" \n" ;
return 0;
}
Anonymous
The second if has a semi colon after ()
Anonymous
what is the issue?
Write a program to read three integer numbers then find and print the largest one among these numbers.
Al
logic is wrong
Anonymous
Fix the semi colon
Anonymous
Al
yes review the logic of comparisons it looks wrong
Anonymous
#include<iostream>
using namespace std;
int main()
{
int x, y, z;
cout<<"enter x and y and z \n";
cin>>x>>y>>z;
if (x>y && x>z)
cout<< x <<"\n";
else if ( y>z )
cout<<y <<"\n";
else
cout<<z<<" \n" ;
return 0;
}
Anonymous
Second if part; else if(y>z)- you added a semi colon
Anonymous
Anonymous
No problem
Anonymous
christian
/*MATRIX ARITHMETIC*/
#include <stdio.h>
#include "conio.h"
int main(int argv,char argc[])
{
int x = 0;
int y = 0;
int i = 0;
int j = 0;
printf("MATRIX ARITHMETIC\n");
printf("Enter array dimension for the array row: ");
scanf("%d", &x);
printf("Enter array dimension for the array colum: ");
scanf("%d", &y);
int a[x][y];
int b[x][y];
int ad[x][y];
int mu[x][y];
//int di[x][y];
int su[x][y];
printf("Enter values for matrix '\A\': \n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("Array[%d][%d] = ", i, j);
scanf("%d", &a[i][j]);
}
}
printf("Enter values for matrix \'B\': \n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("b[%d][%d] = ", i, j);
scanf("%d", &b[i][j]);
}
}
printf("Matrix Addition\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
ad[i][j]=a[i][j]+b[i][j];
}
}
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d\t", ad[i][j]);
}
printf("\n");
}
printf("Matrix Multiplication\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
mu[i][j]=a[i][j]*b[i][j];
}
}
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d\t", mu[i][j]);
}
printf("\n");
}
/*printf("Matrix Division\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
di[i][j]=a[i][j]/b[i][j];
}
}
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d", di[i][j]);
}
printf("\n");
}*/
printf("Matrix Subtraction\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
su[i][j]=a[i][j]-b[i][j];
}
}
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d\t", su[i][j]);
}
printf("\n");
}
getch();
return 0;
}
Anyone help debug this code 😂😂😂😂 it has defeated me 😂😂😂😂
christian
christian
/*MATRIX ARITHMETIC*/
#include <stdio.h>
#include "conio.h"
int main(int argv,char argc[])
{
int x = 0;
int y = 0;
int i = 0;
int j = 0;
printf("MATRIX ARITHMETIC\n");
printf("Enter array dimension for the array row: ");
scanf("%d", &x);
printf("Enter array dimension for the array colum: ");
scanf("%d", &y);
int a[x][y];
int b[x][y];
int ad[x][y];
int mu[x][y];
//int di[x][y];
int su[x][y];
printf("Enter values for matrix '\A\': \n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("Array[%d][%d] = ", i, j);
scanf("%d", &a[i][j]);
}
}
printf("Enter values for matrix \'B\': \n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("b[%d][%d] = ", i, j);
scanf("%d", &b[i][j]);
}
}
printf("Matrix Addition\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
ad[i][j]=a[i][j]+b[i][j];
}
}
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d\t", ad[i][j]);
}
printf("\n");
}
printf("Matrix Multiplication\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
mu[i][j]=a[i][j]*b[i][j];
}
}
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d\t", mu[i][j]);
}
printf("\n");
}
/*printf("Matrix Division\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
di[i][j]=a[i][j]/b[i][j];
}
}
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d", di[i][j]);
}
printf("\n");
}*/
printf("Matrix Subtraction\n");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
su[i][j]=a[i][j]-b[i][j];
}
}
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
printf("%d\t", su[i][j]);
}
printf("\n");
}
getch();
return 0;
}
It's <conio.h> not "conio.h"
محمود
#include <iostream>
#include <algorithm>
int main()
{
int list[3] = {10, 800, 8};
std::cout << *std::max_element(list, list+3);
return 0;
}
محمود
How can I have the user enter the values
.....
cin
Igor🇺🇦
Logina
how can we write a program with while loop which ask the user to enter an integer 10 times and at the end display their sums and their products, I know how can I do it inside the loop but how to do it at the end??
Igor🇺🇦
Afosa
Igor🇺🇦
christian
Afosa
Anonymous
Merry Christmas 🎄
Anonymous
Merry Christmas, guys! :)
Igor🇺🇦
Merry Christmas 🎄
First of all - it's off topic and second - most people in this group don't celebrate this holiday.
Anonymous
Merry Christmas 🎄
Anonymous
Anonymous
Anonymous
We're not here to read hundreds of sentences which are all the same and meaningless.
Anonymous
https://stackoverflow.com/questions/65453470/inputting-a-file-address-from-a-text-file-to-openssl-encryption-function-in-c
Can anyone answer that?
temp
There is problem while fill method is called
temp
Can some one explain why vector does not push_back value.
Cat
make() returns a nullptr. It needs to return "std::make_unique<std::vector<std::shared_ptr<List>>>()".
temp
Thnx
Igor🇺🇦
This is not Linux support group.
VAIBHAV
Anonymous
Hello, can you help
Anonymous
Rewrite the following expression in C ++ Code and print it. a + b + c + d + e Algebra: C ++: = (a + b + c + d + e) / 5; If the parentheses are removed, we obtain a + b + c + d + e / 5, which evaluates incorrectly as: a + b + c + d +e/5
Anonymous
//m=A+B+C+D+E/5
#include <iostream>
using namespace std;
int main (){
int A, B, C , D , E , sum , m;
cout <<"enter the A & B & C & D & E \n";
cin >>A>>B >>C>>D>>E ;
sum = A + B + C + D + E ;
m=sum/5;
cout <<"_____________\n";
cout <<" m = "<< m;}
Anonymous
Is that True or false 😐😐
Junaid
Will some one please share an article about dependent and independent Operationing system
Hadaward 'Solly'
I just opened Silberschatz and nowhere he defines the category of '(in)dependent operating systems'
Junaid
Hadaward 'Solly'
Igor🇺🇦
Device dependent & independent OS
Are you talking about OS-agnostic/cross-platform C/C++ code?
https://linustechtips.com/topic/855181-how-to-write-truly-os-agnosticcross-platform-applications/
Ս
There is a system only having the following:
- mutex lock
- atomic_dec/atomic_inc (atomic operations)
How we can realize rwlock using mutex lock and atomic operations (read write lock)?
I need to:
- describe count of mutex and atomic variables
- describe logic of rwlock_readlock, rwlock_writelock functions
Anonymous
is there a way to use regex in kernel ?
Anonymous
https://paste.ubuntu.com/p/z6rzWcPP7z/
Anonymous
My program is showing I'd returned 1 exit status error
Can someone help?